1 ;; Test for cloning a path ending with indirect branch with -basic-block-sections.
3 declare void @effect(i32 zeroext)
5 ;; Test valid application of cloning for a path with indirect branch.
7 ; RUN: echo 'f bar' >> %t
8 ; RUN: echo 'p 0 1' >> %t
9 ; RUN: echo 'c 0 1.1 2 1' >> %t
10 ; RUN: llc < %s -mtriple=x86_64-pc-linux -O0 -function-sections -basic-block-sections=%t | FileCheck %s
12 define void @bar(i1 %a, i1 %b) {
14 call void @effect(i32 0)
15 br i1 %a, label %b1, label %b2
17 call void @effect(i32 1)
18 %0 = select i1 %b, ; <ptr> [#uses=1]
19 ptr blockaddress(@bar, %b2),
20 ptr blockaddress(@bar, %b3)
21 indirectbr ptr %0, [label %b2, label %b3]
22 b2: ; preds = %b0, %b1
23 call void @effect(i32 2)
26 call void @effect(i32 3) ; preds = %b1
30 ; CHECK: .section .text.bar,"ax",@progbits
32 ; CHECK: # %bb.0: # %b0
34 ; CHECK-NEXT: # %bb.4: # %b1
36 ; CHECK-NEXT: .Ltmp0: # Block address taken
37 ; CHECK-NEXT: .LBB0_2: # %b2
39 ; CHECK-NEXT: # %bb.1: # %b1
41 ; CHECK: .section .text.split.bar,"ax",@progbits
42 ; CHECK: bar.cold: # %b3