1 ;; Test cloning two paths with -basic-block-sections.
3 declare void @effect(i32 zeroext)
6 ; RUN: echo 'f foo' >> %t
7 ; RUN: echo 'p 0 3 5' >> %t
8 ; RUN: echo 'p 1 3 4 5' >> %t
9 ; RUN: echo 'c 0 3.1 5.1' >> %t
10 ; RUN: echo 'c 1 3.2 4.1 5.2 2 3 4 5' >> %t
11 ; RUN: llc < %s -mtriple=x86_64-pc-linux -O0 -function-sections -basic-block-sections=%t | FileCheck %s
12 ; 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
14 define void @foo(i1 %a, i1 %b, i1 %c, i1 %d) {
16 call void @effect(i32 0)
17 br i1 %a, label %b1, label %b3
20 call void @effect(i32 1)
21 br i1 %b, label %b2, label %b3
24 call void @effect(i32 2)
27 b3: ; preds = %b0, %b1, %b2
28 call void @effect(i32 3)
29 br i1 %c, label %b4, label %b5
32 call void @effect(i32 4)
33 br i1 %d, label %b5, label %cold
35 b5: ; preds = %b3, %b4
36 call void @effect(i32 5)
39 call void @effect(i32 6) ; preds = %b4
43 ;; Check the cloned block ids in MIR.
45 ; MIR: bb.7.b3 (bb_id 3 1):
46 ; MIR: bb.8.b5 (bb_id 5 1):
47 ; MIR: bb.9.b3 (bb_id 3 2):
48 ; MIR: bb.10.b4 (bb_id 4 1):
49 ; MIR: bb.11.b5 (bb_id 5 2):
51 ;; Check the final layout and branches.
54 ; CHECK: .section .text.foo,"ax",@progbits
56 ; CHECK: # %bb.0: # %b0
57 ; CHECK: jne foo.__part.1
58 ; CHECK-NEXT: # %bb.7: # %b3
60 ; CHECK-NEXT: # %bb.8: # %b5
64 ; CHECK: .section .text.foo,"ax",@progbits,unique,1
65 ; CHECK-NEXT: foo.__part.1: # %b1
67 ; CHECK-NEXT: # %bb.9: # %b3
69 ; CHECK-NEXT: # %bb.10: # %b4
71 ; CHECK-NEXT: # %bb.11: # %b5
73 ; CHECK-NEXT: .LBB0_2: # %b2
74 ; CHECK: callq effect@PLT
75 ; CHECK-NEXT: # %bb.3: # %b3
77 ; CHECK-NEXT: .LBB0_4: # %b4
79 ; CHECK-NEXT: .LBB0_5: # %b5
83 ; CHECK: .section .text.split.foo,"ax",@progbits
84 ; CHECK: foo.cold: # %cold