summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-12-09 02:52:17 +0000
committerDan Gohman <gohman@apple.com>2010-12-09 02:52:17 +0000
commita32986e899238fe3f657e99e1bc3716fbc7c355e (patch)
treee6d7d331a35278c616cc753ad56d645471e4047e /llvm/lib
parentd62c9be4fc3d3f2c972946b56b0712440b9c7316 (diff)
downloadbcm5719-llvm-a32986e899238fe3f657e99e1bc3716fbc7c355e.tar.gz
bcm5719-llvm-a32986e899238fe3f657e99e1bc3716fbc7c355e.zip
Really check that the bits that will become zero are actually already zero
before eliminating the operation that zeros them. This fixes rdar://8739316. llvm-svn: 121353
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
index e52f2013fe5..e3232a491b7 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
@@ -168,9 +168,8 @@ 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) {
- unsigned LowBits = CI->getZExtValue() - NumBits;
if (MaskedValueIsZero(I->getOperand(0),
- APInt::getLowBitsSet(TypeWidth, LowBits) << NumBits))
+ APInt::getLowBitsSet(TypeWidth, NumBits)))
return true;
}
OpenPOWER on IntegriCloud