summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2012-10-26 19:52:27 +0000
committerDerek Schuff <dschuff@google.com>2012-10-26 19:52:27 +0000
commitb61054ff8f5568489109a0ccf2799307c3671309 (patch)
treeac4574485813a3da8c68f37dfa7d3f73360b344e /include
parentecc69a1d99963b2b1bba92bdcefbfa8a8f1c497a (diff)
downloadllvm-b61054ff8f5568489109a0ccf2799307c3671309.tar.gz
llvm-b61054ff8f5568489109a0ccf2799307c3671309.tar.bz2
llvm-b61054ff8f5568489109a0ccf2799307c3671309.tar.xz
Stop APInt::shl from generating llvm.trap
APInt::shl generated llvm.trap to guard against shifts greater than bit-width. This was already checked with an assert, and there was a special case for shifts equal to bit-width. Modify this check to catch shifts greater than or equal to bit-width, so llvm.trap isn't generated. Patch contributed by JF Bastien git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166803 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/APInt.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h
index 4470534e04..90114e2b84 100644
--- a/include/llvm/ADT/APInt.h
+++ b/include/llvm/ADT/APInt.h
@@ -760,7 +760,7 @@ public:
APInt shl(unsigned shiftAmt) const {
assert(shiftAmt <= BitWidth && "Invalid shift amount");
if (isSingleWord()) {
- if (shiftAmt == BitWidth)
+ if (shiftAmt >= BitWidth)
return APInt(BitWidth, 0); // avoid undefined shift results
return APInt(BitWidth, VAL << shiftAmt);
}