[llvm-commits] [llvm] r127465 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp test/Transforms/InstCombine/sext.ll
Benjamin Kramer
benny.kra at googlemail.com
Fri Mar 11 06:46:50 PST 2011
Author: d0k
Date: Fri Mar 11 08:46:49 2011
New Revision: 127465
URL: http://llvm.org/viewvc/llvm-project?rev=127465&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
llvm/trunk/test/Transforms/InstCombine/sext.ll
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=127465&r1=127464&r2=127465&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Fri Mar 11 08:46:49 2011
@@ -431,7 +431,8 @@
}
// 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 ...
Modified: llvm/trunk/test/Transforms/InstCombine/sext.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/sext.ll?rev=127465&r1=127464&r2=127465&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/sext.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/sext.ll Fri Mar 11 08:46:49 2011
@@ -126,3 +126,13 @@
; CHECK-NEXT: store <2 x i16>
; CHECK-NEXT: ret
}
+
+define i64 @test12(i32 %x) nounwind {
+ %shr = lshr i32 %x, 1
+ %sub = sub nsw i32 0, %shr
+ %conv = sext i32 %sub to i64
+ ret i64 %conv
+; CHECK: @test12
+; CHECK: sext
+; CHECK: ret
+}
More information about the llvm-commits
mailing list