1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -jump-threading -S < %s | FileCheck %s
8 ; br on cond.fr should be removed & ENTRY -> A -> B should be threaded
9 define i32 @simple(i1 %cond) {
10 ; CHECK-LABEL: @simple(
12 ; CHECK-NEXT: br i1 [[COND:%.*]], label [[B:%.*]], label [[EXIT:%.*]]
14 ; CHECK-NEXT: call void @f()
15 ; CHECK-NEXT: ret i32 1
17 ; CHECK-NEXT: ret i32 0
20 %cond.fr = freeze i1 %cond
21 br i1 %cond, label %A, label %EXIT
23 br i1 %cond.fr, label %B, label %EXIT
31 define void @switch(i32 %cond) {
32 ; CHECK-LABEL: @switch(
34 ; CHECK-NEXT: [[COND_FR:%.*]] = freeze i32 [[COND:%.*]]
35 ; CHECK-NEXT: switch i32 [[COND]], label [[DEFAULT:%.*]] [
36 ; CHECK-NEXT: i32 0, label [[A_TAKEN:%.*]]
37 ; CHECK-NEXT: i32 1, label [[B_TAKEN:%.*]]
40 ; CHECK-NEXT: switch i32 [[COND_FR]], label [[PRESERVED1:%.*]] [
41 ; CHECK-NEXT: i32 0, label [[PRESERVED2:%.*]]
44 ; CHECK-NEXT: call void @f()
45 ; CHECK-NEXT: ret void
47 ; CHECK-NEXT: call void @f2()
48 ; CHECK-NEXT: ret void
50 ; CHECK-NEXT: call void @f()
51 ; CHECK-NEXT: ret void
53 ; CHECK-NEXT: call void @f()
54 ; CHECK-NEXT: ret void
57 %cond.fr = freeze i32 %cond
58 switch i32 %cond, label %DEFAULT [
63 switch i32 %cond.fr, label %PRESERVED1 [
64 i32 0, label %PRESERVED2
74 switch i32 %cond.fr, label %A_NOTTAKEN [
85 switch i32 %cond.fr, label %B_TAKEN [
86 i32 0, label %B_NOTTAKEN