xref: /llvm-project/llvm/test/Transforms/PGOProfile/callbr.ll (revision 0caa4a9559edcbb4195ce140de0658e46a90b52a)
1; RUN: opt -passes=pgo-instr-gen -S 2>&1 < %s | FileCheck %s
2;
3; RUN: llvm-profdata merge %S/Inputs/callbr.proftext -o %t.profdata
4; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
5
6
7define i32 @a() {
8entry:
9; CHECK-NOT: ptrtoint ptr asm sideeffect
10; CHECK: callbr void asm sideeffect
11  %retval = alloca i32, align 4
12  callbr void asm sideeffect "", "!i,~{dirflag},~{fpsr},~{flags}"() #1
13          to label %asm.fallthrough [label %b]
14
15asm.fallthrough:
16  br label %b
17
18b:
19  %0 = load i32, ptr %retval, align 4
20  ret i32 %0
21}
22; USE-LABEL: @a
23; USE-SAME: !prof ![[BW_ENTRY:[0-9]+]]
24; USE: callbr void asm sideeffect
25; USE: to label
26; USE-SAME: !prof ![[BW_CALLBR:[0-9]+]]
27; USE ![[BW_ENTRY]] = !{!"function_entry_count", i64 100}
28; USE ![[BW_CALLBR]] = !{!"branch_weights", i32 80, i32 20}
29
30