1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt -passes=callsite-splitting -S -o - < %s | FileCheck %s
4 ; Check that we can split the critical edge between Top and CallSiteBB, and
5 ; rewrite the first callbr's indirect destination correctly.
7 define void @caller() {
8 ; CHECK-LABEL: define {{[^@]+}}@caller() {
10 ; CHECK-NEXT: callbr void asm sideeffect "", "!i,~{dirflag},~{fpsr},~{flags}"()
11 ; CHECK-NEXT: to label [[NEXTCOND:%.*]] [label %Top.split]
13 ; CHECK-NEXT: call void @callee(i1 false)
14 ; CHECK-NEXT: br label [[CALLSITEBB:%.*]]
16 ; CHECK-NEXT: br label [[NEXTCOND_SPLIT:%.*]]
17 ; CHECK: NextCond.split:
18 ; CHECK-NEXT: call void @callee(i1 true)
19 ; CHECK-NEXT: br label [[CALLSITEBB]]
21 ; CHECK-NEXT: [[PHI:%.*]] = phi i1 [ false, [[TOP_SPLIT:%.*]] ], [ true, [[NEXTCOND_SPLIT]] ]
22 ; CHECK-NEXT: callbr void asm sideeffect "", "r,!i,~{dirflag},~{fpsr},~{flags}"(i1 [[PHI]])
23 ; CHECK-NEXT: to label [[END:%.*]] [label %End2]
25 ; CHECK-NEXT: ret void
27 ; CHECK-NEXT: ret void
30 callbr void asm sideeffect "", "!i,~{dirflag},~{fpsr},~{flags}"()
31 to label %NextCond [label %CallSiteBB]
37 %phi = phi i1 [0, %Top],[1, %NextCond]
38 call void @callee(i1 %phi)
39 callbr void asm sideeffect "", "r,!i,~{dirflag},~{fpsr},~{flags}"(i1 %phi)
40 to label %End [label %End2]
48 define void @callee(i1 %b) {
49 ; CHECK-LABEL: define {{[^@]+}}@callee
50 ; CHECK-SAME: (i1 [[B:%.*]]) {
51 ; CHECK-NEXT: ret void