1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -S -jump-threading | FileCheck %s
4 ; This test used to cause jump threading to try to split an edge of a callbr.
11 ; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a
12 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[TMP0]], 0
13 ; CHECK-NEXT: br i1 [[TOBOOL]], label [[IF_ELSE:%.*]], label [[IF_THEN:%.*]]
15 ; CHECK-NEXT: [[CALL:%.*]] = call i32 @b()
16 ; CHECK-NEXT: [[PHITMP:%.*]] = icmp ne i32 [[CALL]], 0
17 ; CHECK-NEXT: br i1 [[PHITMP]], label [[IF_THEN2:%.*]], label [[IF_END4:%.*]]
19 ; CHECK-NEXT: callbr void asm sideeffect "", "X"(i8* blockaddress(@c, [[IF_THEN2]]))
20 ; CHECK-NEXT: to label [[IF_END_THREAD:%.*]] [label %if.then2]
21 ; CHECK: if.end.thread:
22 ; CHECK-NEXT: br label [[IF_THEN2]]
24 ; CHECK-NEXT: [[CALL3:%.*]] = call i32 @b()
25 ; CHECK-NEXT: br label [[IF_END4]]
27 ; CHECK-NEXT: ret i32 undef
30 %0 = load i32, i32* @a
31 %tobool = icmp eq i32 %0, 0
32 br i1 %tobool, label %if.else, label %if.then
34 if.then: ; preds = %entry
35 %call = call i32 @b() #2
36 %phitmp = icmp ne i32 %call, 0
39 if.else: ; preds = %entry
40 callbr void asm sideeffect "", "X"(i8* blockaddress(@c, %if.end)) #2
41 to label %normal [label %if.end]
43 normal: ; preds = %if.else
46 if.end: ; preds = %if.else, %normal, %if.then
47 %d.0 = phi i1 [ %phitmp, %if.then ], [ undef, %normal ], [ undef, %if.else ]
48 br i1 %d.0, label %if.then2, label %if.end4
50 if.then2: ; preds = %if.end
51 %call3 = call i32 @b()
54 if.end4: ; preds = %if.then2, %if.end