diff options
Diffstat (limited to 'test/Transforms/JumpThreading/basic.ll')
-rw-r--r-- | test/Transforms/JumpThreading/basic.ll | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/test/Transforms/JumpThreading/basic.ll b/test/Transforms/JumpThreading/basic.ll index 1a602a6..cab7712 100644 --- a/test/Transforms/JumpThreading/basic.ll +++ b/test/Transforms/JumpThreading/basic.ll @@ -1,6 +1,4 @@ ; RUN: opt < %s -jump-threading -S | FileCheck %s -; There should be no uncond branches left. -; RUN: opt < %s -jump-threading -S | not grep {br label} declare i32 @f1() declare i32 @f2() @@ -75,3 +73,35 @@ T1: F1: ret i32 17 } + +define i32 @test4(i1 %cond, i1 %cond2) { +; CHECK: @test4 + + br i1 %cond, label %T1, label %F1 + +T1: +; CHECK: %v1 = call i32 @f1() +; CHECK-NEXT: br label %T + + %v1 = call i32 @f1() + br label %Merge + +F1: + %v2 = call i32 @f2() +; CHECK: %v2 = call i32 @f2() +; CHECK-NEXT: br i1 %cond2, + br label %Merge + +Merge: + %A = phi i1 [undef, %T1], [%cond2, %F1] + %B = phi i32 [%v1, %T1], [%v2, %F1] + br i1 %A, label %T2, label %F2 + +T2: + call void @f3() + ret i32 %B + +F2: + ret i32 %B +} + |