1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=jump-threading -S < %s | FileCheck %s
8 define i32 @test(i1 %cond, i1 %a, i1 %b) {
10 ; CHECK-NEXT: br i1 [[COND:%.*]], label [[A:%.*]], label [[C:%.*]]
12 ; CHECK-NEXT: call void @f()
13 ; CHECK-NEXT: br i1 [[A:%.*]], label [[EXIT1:%.*]], label [[EXIT2:%.*]]
15 ; CHECK-NEXT: call void @g()
16 ; CHECK-NEXT: br i1 [[B:%.*]], label [[EXIT1]], label [[EXIT2]]
18 ; CHECK-NEXT: ret i32 0
20 ; CHECK-NEXT: ret i32 1
22 br i1 %cond, label %A, label %B
30 %p = phi i1 [%a, %A], [%b, %B] ; Check that this is removed
31 br i1 %p, label %EXIT1, label %EXIT2
38 define i32 @test2(i1 %cond, i1 %a, i1 %b) {
39 ; CHECK-LABEL: @test2(
40 ; CHECK-NEXT: br i1 [[COND:%.*]], label [[A:%.*]], label [[C:%.*]]
42 ; CHECK-NEXT: call void @f()
43 ; CHECK-NEXT: [[P_FR1:%.*]] = freeze i1 [[A:%.*]]
44 ; CHECK-NEXT: br i1 [[P_FR1]], label [[EXIT1:%.*]], label [[EXIT2:%.*]]
46 ; CHECK-NEXT: call void @g()
47 ; CHECK-NEXT: [[P_FR:%.*]] = freeze i1 [[B:%.*]]
48 ; CHECK-NEXT: br i1 [[P_FR]], label [[EXIT1]], label [[EXIT2]]
50 ; CHECK-NEXT: ret i32 0
52 ; CHECK-NEXT: ret i32 1
54 br i1 %cond, label %A, label %B
62 %p = phi i1 [%a, %A], [%b, %B] ; Check that this is removed
64 br i1 %p.fr, label %EXIT1, label %EXIT2