[llvm-commits] [llvm] r98416 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp test/Transforms/InstCombine/shift-sra.ll
Evan Cheng
evan.cheng at apple.com
Fri Mar 12 18:20:29 PST 2010
Author: evancheng
Date: Fri Mar 12 20:20:29 2010
New Revision: 98416
URL: http://llvm.org/viewvc/llvm-project?rev=98416&view=rev
Log:
Fix a typo in ValueTracking that's causing instcombine to delete needed shift instructions.
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
llvm/trunk/test/Transforms/InstCombine/shift-sra.ll
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=98416&r1=98415&r2=98416&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Fri Mar 12 20:20:29 2010
@@ -779,7 +779,7 @@
for (unsigned i = 1, e = PN->getNumIncomingValues(); i != e; ++i) {
if (Tmp == 1) return Tmp;
Tmp = std::min(Tmp,
- ComputeNumSignBits(PN->getIncomingValue(1), TD, Depth+1));
+ ComputeNumSignBits(PN->getIncomingValue(i), TD, Depth+1));
}
return Tmp;
}
Modified: llvm/trunk/test/Transforms/InstCombine/shift-sra.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/shift-sra.ll?rev=98416&r1=98415&r2=98416&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/shift-sra.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/shift-sra.ll Fri Mar 12 20:20:29 2010
@@ -56,3 +56,23 @@
; CHECK: %P = phi i64
; CHECK-NEXT: ret i64 %P
}
+
+; rdar://7732987
+define i32 @test5(i32 %Y) {
+ br i1 undef, label %A, label %C
+A:
+ br i1 undef, label %B, label %D
+B:
+ br label %D
+C:
+ br i1 undef, label %D, label %E
+D:
+ %P = phi i32 [0, %A], [0, %B], [%Y, %C]
+ %S = ashr i32 %P, 16
+ ret i32 %S
+; CHECK: @test5
+; CHECK: %P = phi i32
+; CHECK-NEXT: ashr i32 %P, 16
+E:
+ ret i32 0
+}
More information about the llvm-commits
mailing list