1 ;; Test cloning a single path with -basic-block-sections.
3 declare void @effect(i32 zeroext)
5 ;; Test a valid application of path cloning.
7 ; RUN: echo 'f foo' >> %t
8 ; RUN: echo 'p 0 3 5' >> %t
9 ; RUN: echo 'c 0 3.1 5.1 1 2 3 4 5' >> %t
10 ; RUN: llc < %s -mtriple=x86_64-pc-linux -O0 -function-sections -basic-block-sections=%t | FileCheck %s
11 ; RUN: llc < %s -mtriple=x86_64-pc-linux -O0 -function-sections -basic-block-sections=%t -stop-after=bb-path-cloning | FileCheck %s --check-prefix=MIR
13 define void @foo(i1 %a, i1 %b, i1 %c, i1 %d) {
15 call void @effect(i32 0)
16 br i1 %a, label %b1, label %b3
19 call void @effect(i32 1)
20 br i1 %b, label %b2, label %b3
23 call void @effect(i32 2)
26 b3: ; preds = %b0, %b1, %b2
27 call void @effect(i32 3)
28 br i1 %c, label %b4, label %b5
31 call void @effect(i32 4)
32 br i1 %d, label %b5, label %cold
34 b5: ; preds = %b3, %b4
35 call void @effect(i32 5)
38 call void @effect(i32 6) ; preds = %b4
42 ;; Check the cloned block ids in MIR.
44 ; MIR: bb.7.b3 (bb_id 3 1):
45 ; MIR: bb.8.b5 (bb_id 5 1):
47 ;; Check the final layout and branches.
50 ; CHECK: .section .text.foo,"ax",@progbits
52 ; CHECK: # %bb.0: # %b0
54 ; CHECK-NEXT: # %bb.7: # %b3
56 ; CHECK-NEXT: # %bb.8: # %b5
58 ; CHECK-NEXT: .LBB0_1: # %b1
60 ; CHECK-NEXT: # %bb.2: # %b2
61 ; CHECK: callq effect@PLT
62 ; CHECK-NEXT: .LBB0_3: # %b3
64 ; CHECK-NEXT: .LBB0_4: # %b4
66 ; CHECK-NEXT: .LBB0_5: # %b5
70 ; CHECK: .section .text.split.foo,"ax",@progbits
71 ; CHECK: foo.cold: # %cold