mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
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 llvm-svn: 166803
This commit is contained in:
parent
9cb3d9d08c
commit
e93c168939
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user