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 | 152f106e5f49f503168a7df8a672ea0f3332290a (patch) | |
tree | 758a316587e9b0f7fa062c88000f5ea34a488717 /llvm/lib | |
parent | 6ccb51130e8a2155f9fcaeac38c40f5bfdbc210a (diff) | |
download | bcm5719-llvm-152f106e5f49f503168a7df8a672ea0f3332290a.tar.gz bcm5719-llvm-152f106e5f49f503168a7df8a672ea0f3332290a.zip |
PR12967: Don't crash when trying to fold a shift that's larger than the type's size.
llvm-svn: 157548
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp index 4c14509cb60..4bb2403299c 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/llvm/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)) |