diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-05-27 22:03:32 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-05-27 22:03:32 +0000 |
| commit | 65195411ccb18ea8327d3eabdfa980eaf535d929 (patch) | |
| tree | 63d38f1d5c8b92d1ecfe92cb17bc5eafc49e6eaa /lib/Transforms | |
| parent | 5acc40a0373ed183d944b4f165dbb0b6798d5a92 (diff) | |
| download | external_llvm-65195411ccb18ea8327d3eabdfa980eaf535d929.zip external_llvm-65195411ccb18ea8327d3eabdfa980eaf535d929.tar.gz external_llvm-65195411ccb18ea8327d3eabdfa980eaf535d929.tar.bz2 | |
PR12967: Don't crash when trying to fold a shift that's larger than the type's size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157548 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
| -rw-r--r-- | lib/Transforms/InstCombine/InstCombineShifts.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineShifts.cpp b/lib/Transforms/InstCombine/InstCombineShifts.cpp index 4c14509..4bb2403 100644 --- a/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/lib/Transforms/InstCombine/InstCombineShifts.cpp @@ -151,7 +151,7 @@ static bool CanEvaluateShifted(Value *V, unsigned NumBits, bool isLeftShift, // We can always turn lshr(c1)+shl(c2) -> lshr(c3)+and(c4), but it isn't // profitable unless we know the and'd out bits are already zero. - if (CI->getZExtValue() > NumBits) { + if (CI->getValue().ult(TypeWidth) && CI->getZExtValue() > NumBits) { unsigned LowBits = CI->getZExtValue() - NumBits; if (MaskedValueIsZero(I->getOperand(0), APInt::getLowBitsSet(TypeWidth, NumBits) << LowBits)) |
