summaryrefslogtreecommitdiff
path: root/lib/Analysis
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
commit2715a581494ef0c7f7403f9f7dbe4c0d052d61a5 (patch)
tree7f38e96b0239c201408a83a0b4c2b20b579d921b /lib/Analysis
parent6b4972518cff5b0f76ec63fc8b93b74ae64c3f3d (diff)
downloadllvm-2715a581494ef0c7f7403f9f7dbe4c0d052d61a5.tar.gz
llvm-2715a581494ef0c7f7403f9f7dbe4c0d052d61a5.tar.bz2
llvm-2715a581494ef0c7f7403f9f7dbe4c0d052d61a5.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127465 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/ValueTracking.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index 33fb1e8cdc..6c33d2d508 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/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 ...