1 ; RUN: opt -loop-unswitch -enable-new-pm=0 %s -S | FileCheck %s
3 ; We want to check that the loop does not get split (so only 2 callbr's not 4).
4 ; It's ok to modify this test in the future should we allow the loop containing
5 ; callbr to be unswitched and are able to do so correctly.
7 ; CHECK: callbr void asm sideeffect "# ${0:l}", "X,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@foo, %10))
8 ; CHECK: to label %7 [label %10]
9 ; CHECK: callbr void asm sideeffect "# ${0:l}", "X,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@foo, %10))
10 ; CHECK: to label %9 [label %10]
12 ; CHECK-NOT: callbr void asm sideeffect "# ${0:l}", "X,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@foo, %10))
13 ; CHECK-NOT: to label %7 [label %10]
14 ; CHECK-NOT: callbr void asm sideeffect "# ${0:l}", "X,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@foo, %10))
15 ; CHECK-NOT: to label %9 [label %10]
16 ; CHECK-NOT: callbr void asm sideeffect "# ${0:l}", "X,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@foo, %19))
17 ; CHECK-NOT: to label %16 [label %19]
18 ; CHECK-NOT: callbr void asm sideeffect "# ${0:l}", "X,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@foo, %19))
19 ; CHECK-NOT: to label %18 [label %19]
21 ; This test is essentially:
23 ; for (int i = 0; i < 1000; ++i)
25 ; asm goto("# %l0"::::bar);
28 ; asm goto("# %l0"::::baz);
33 define dso_local void @foo(i32) #0 {
37 %.0 = phi i32 [ 0, %1 ], [ %11, %10 ]
38 %3 = icmp ult i32 %.0, 1000
39 br i1 %3, label %4, label %12
42 %5 = icmp eq i32 %0, 0
43 br i1 %5, label %8, label %6
46 callbr void asm sideeffect "# ${0:l}", "X,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@foo, %10)) #0
47 to label %7 [label %10]
53 callbr void asm sideeffect "# ${0:l}", "X,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@foo, %10)) #0
54 to label %9 [label %10]
59 10: ; preds = %7, %6, %9, %8
60 %11 = add nuw nsw i32 %.0, 1