aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-03-11 14:46:49 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-03-11 14:46:49 +0000
commit391a946fa98296f8f525c060b62f499facaff9d2 (patch)
tree4a10409f268b529be3896ecf64e2f7f567fe626a /llvm/lib/Analysis/ValueTracking.cpp
parent51897bcd3eead808ec85318b64d42cdda75b9e21 (diff)
downloadllvm-391a946fa98296f8f525c060b62f499facaff9d2.zip
llvm-391a946fa98296f8f525c060b62f499facaff9d2.tar.gz
llvm-391a946fa98296f8f525c060b62f499facaff9d2.tar.bz2
ComputeMaskedBits: sub falls through to add, and sub doesn't have the same overflow semantics as add.
Should fix the selfhost failures that started with r127463. llvm-svn: 127465
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 33fb1e8..6c33d2d 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -431,7 +431,8 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
}
// Are we still trying to solve for the sign bit?
- if (Mask.isNegative() && !KnownZero.isNegative() && !KnownOne.isNegative()){
+ if (I->getOpcode() == Instruction::Add &&
+ Mask.isNegative() && !KnownZero.isNegative() && !KnownOne.isNegative()){
OverflowingBinaryOperator *OBO = cast<OverflowingBinaryOperator>(I);
if (OBO->hasNoSignedWrap()) {
// Adding two positive numbers can't wrap into negative ...