summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1c96b41)
raw | patch | inline | side by side (parent: 1c96b41)
author | Chris Lattner <sabre@nondot.org> | |
Thu, 12 Nov 2009 01:41:34 +0000 (01:41 +0000) | ||
committer | Chris Lattner <sabre@nondot.org> | |
Thu, 12 Nov 2009 01:41:34 +0000 (01:41 +0000) |
allows us to handle the test10 testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86924 91177308-0d34-0410-b5e6-96231b3b80d8
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86924 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/JumpThreading.cpp | patch | blob | history | |
test/Transforms/JumpThreading/basic.ll | patch | blob | history |
index e7ca0f4b50fd71f28fc9b8ec83e1b1b2145f9769..47bebf90d3ce50740703e3553c77cf8719aad792 100644 (file)
}
// All the rest of our checks depend on the condition being an instruction.
- if (CondInst == 0)
+ if (CondInst == 0) {
+ // FIXME: Unify this with code below.
+ if (LVI && ProcessThreadableEdges(Condition, BB))
+ return true;
return false;
+ }
+
// See if this is a phi node in the current block.
if (PHINode *PN = dyn_cast<PHINode>(CondInst))
index 514c865f9c9ce1df029ae73500adaf9cd1109105..4a1a2868cae8420a8441991c2c5dec8041ba1d60 100644 (file)
+; CHECK: @test10
+declare i32 @test10f1()
+declare i32 @test10f2()
+declare void @test10f3()
+
+;; Non-local condition threading.
+define i32 @test10(i1 %cond) {
+; CHECK: @test10
+; CHECK-NEXT: br i1 %cond, label %T2, label %F2
+ br i1 %cond, label %T1, label %F1
+
+T1:
+ %v1 = call i32 @test10f1()
+ br label %Merge
+
+; CHECK: %v1 = call i32 @test10f1()
+; CHECK-NEXT: call void @f3()
+; CHeCK-NEXT: ret i32 %v1
+
+F1:
+ %v2 = call i32 @test10f2()
+ br label %Merge
+
+Merge:
+ %B = phi i32 [%v1, %T1], [%v2, %F1]
+ br i1 %cond, label %T2, label %F2
+
+T2:
+ call void @f3()
+ ret i32 %B
+
+F2:
+ ret i32 %B
+}
+
+
+
+
;;; Duplicate condition to avoid xor of cond.
;;; TODO: Make this happen.
-define i32 @test10(i1 %cond, i1 %cond2) {
+define i32 @test11(i1 %cond, i1 %cond2) {
Entry:
-; CHECK: @test10
+; CHECK: @test11
%v1 = call i32 @f1()
br i1 %cond, label %Merge, label %F1