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
This commit is contained in:
Benjamin Kramer
2011-03-11 14:46:49 +00:00
parent 6b4972518c
commit 2715a58149
2 changed files with 12 additions and 1 deletions
+2 -1
View File
@@ -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 ...