diff options
| author | Craig Topper <craig.topper@gmail.com> | 2017-04-16 01:03:51 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2017-04-16 01:03:51 +0000 |
| commit | 9edfb08d935a3d4c2bd662732cd5a93254452f51 (patch) | |
| tree | 6cc6b3355884da028cd5cb5b01d21a0022f6d059 /llvm/lib | |
| parent | 909b3376ba266bb75f46d007035e8ede8f03a8b6 (diff) | |
| download | bcm5719-llvm-9edfb08d935a3d4c2bd662732cd5a93254452f51.tar.gz bcm5719-llvm-9edfb08d935a3d4c2bd662732cd5a93254452f51.zip | |
[APInt] Fix a bug in lshr by a value more than 64 bits above the bit width.
This was throwing an assert because we determined the intra-word shift amount by subtracting the size of the full word shift from the total shift amount. But we failed to account for the fact that we clipped the full word shifts by total words first. To fix this just calculate the intra-word shift as the remainder of dividing by bits per word.
llvm-svn: 300405
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Support/APInt.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 03f7f5b56e3..0c7da1dad0d 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -1188,7 +1188,7 @@ void APInt::lshrInPlace(unsigned shiftAmt) { // Fill in first Words - ShiftFullWords by shifting. lshrWords(pVal, pVal + ShiftFullWords, Words - ShiftFullWords, - shiftAmt - (ShiftFullWords * APINT_BITS_PER_WORD)); + shiftAmt % APINT_BITS_PER_WORD); // The remaining high words are all zero. for (unsigned I = Words - ShiftFullWords; I != Words; ++I) |

