1;; This test verifies that basic-block-sections works with address-taken basic blocks.
2; RUN: llc < %s -mtriple=x86_64 -basic-block-sections=all | FileCheck %s
3
4define void @foo(i1 zeroext %0) nounwind {
5entry:
6  %1 = select i1 %0, i8* blockaddress(@foo, %bb1), i8* blockaddress(@foo, %bb2) ; <i8*> [#uses=1]
7  indirectbr i8* %1, [label %bb1, label %bb2]
8
9; CHECK:         .text
10; CHECK:         .section .text.foo,"ax",@progbits
11; CHECK-LABEL: foo:
12; CHECK:         movl    $.Ltmp0, %eax
13; CHECK-NEXT:    movl    $.Ltmp1, %ecx
14; CHECK-NEXT:    cmovneq %rax, %rcx
15; CHECK-NEXT:    jmpq    *%rcx
16
17bb1:                                                ; preds = %entry
18  %2 = call i32 @bar()
19  ret void
20; CHECK:         .section .text.foo,"ax",@progbits,unique,1
21; CHECK-NEXT:  .Ltmp0:
22; CHECK-NEXT:  foo.__part.1
23; CHECK-NEXT:    callq   bar
24;
25
26bb2:                                                ; preds = %entry
27  %3 = call i32 @baz()
28  ret void
29; CHECK:         .section .text.foo,"ax",@progbits,unique,2
30; CHECK-NEXT:  .Ltmp1:
31; CHECK-NEXT:  foo.__part.2
32; CHECK-NEXT:    callq   baz
33}
34
35declare i32 @bar()
36declare i32 @baz()
37