diff options
author | Duncan Sands <baldrick@free.fr> | 2008-06-09 11:32:28 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-06-09 11:32:28 +0000 |
commit | 8eab8a2798fe74c98703bdeac64661beea0b4dbc (patch) | |
tree | b4b9c225ff328ae733c43c4b0dd76f05db0dcace /include | |
parent | eddc8f1f8b860adf408414391dc64170a8a2a87e (diff) | |
download | external_llvm-8eab8a2798fe74c98703bdeac64661beea0b4dbc.zip external_llvm-8eab8a2798fe74c98703bdeac64661beea0b4dbc.tar.gz external_llvm-8eab8a2798fe74c98703bdeac64661beea0b4dbc.tar.bz2 |
Remove some DAG combiner assumptions about sizes
of integer types. Fix the isMask APInt method to
actually work (hopefully) rather than crashing
because it adds apints of different bitwidths.
It looks like isShiftedMask is also broken, but
I'm leaving that one to the APInt people (it is
not used anywhere).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52142 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ADT/APInt.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index 628f860..d2a1baf 100644 --- a/include/llvm/ADT/APInt.h +++ b/include/llvm/ADT/APInt.h @@ -130,7 +130,7 @@ class APInt { // the word size (64). return *this; - // Mask out the hight bits. + // Mask out the high bits. uint64_t mask = ~uint64_t(0ULL) >> (APINT_BITS_PER_WORD - wordBits); if (isSingleWord()) VAL &= mask; @@ -1280,7 +1280,8 @@ inline bool isSignedIntN(uint32_t N, const APInt& APIVal) { /// @returns true if the argument APInt value is a sequence of ones /// starting at the least significant bit with the remainder zero. inline bool isMask(uint32_t numBits, const APInt& APIVal) { - return APIVal.getBoolValue() && ((APIVal + APInt(numBits,1)) & APIVal) == 0; + return numBits <= APIVal.getBitWidth() && + APIVal == APInt::getLowBitsSet(APIVal.getBitWidth(), numBits); } /// @returns true if the argument APInt value contains a sequence of ones |