xref: /llvm-project/llvm/test/Transforms/PGOProfile/ctx-prof-use-prelink.ll (revision 9c0ba62010b5850adf6b4c3979128aa6e9189aca)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 5
2; There is no profile, but that's OK because the prelink does not care about
3; the content of the profile, just that we intend to use one.
4; There is no scenario currently of doing ctx profile use without thinlto.
5;
6; RUN: opt -passes='thinlto-pre-link<O2>' -use-ctx-profile=something_that_does_not_exist %s -S | FileCheck %s
7; RUN: opt -debug-info-for-profiling -passes='thinlto-pre-link<O2>' -use-ctx-profile=something_that_does_not_exist %s -S | FileCheck %s
8
9declare void @bar()
10
11define void @foo(i32 %a, ptr %fct) {
12; CHECK-LABEL: define void @foo(
13; CHECK-SAME: i32 [[A:%.*]], ptr [[FCT:%.*]]) local_unnamed_addr !guid [[META0:![0-9]+]] {
14; CHECK-NEXT:    call void @llvm.instrprof.increment(ptr @foo, i64 728453322856651412, i32 2, i32 0)
15; CHECK-NEXT:    [[T:%.*]] = icmp eq i32 [[A]], 0
16; CHECK-NEXT:    br i1 [[T]], label %[[YES:.*]], label %[[NO:.*]]
17; CHECK:       [[YES]]:
18; CHECK-NEXT:    call void @llvm.instrprof.increment(ptr @foo, i64 728453322856651412, i32 2, i32 1)
19; CHECK-NEXT:    call void @llvm.instrprof.callsite(ptr @foo, i64 728453322856651412, i32 2, i32 0, ptr [[FCT]])
20; CHECK-NEXT:    call void [[FCT]](i32 0)
21; CHECK-NEXT:    br label %[[EXIT:.*]]
22; CHECK:       [[NO]]:
23; CHECK-NEXT:    call void @llvm.instrprof.callsite(ptr @foo, i64 728453322856651412, i32 2, i32 1, ptr @bar)
24; CHECK-NEXT:    call void @bar()
25; CHECK-NEXT:    br label %[[EXIT]]
26; CHECK:       [[EXIT]]:
27; CHECK-NEXT:    ret void
28;
29  %t = icmp eq i32 %a, 0
30  br i1 %t, label %yes, label %no
31yes:
32  call void %fct(i32 %a)
33  br label %exit
34no:
35  call void @bar()
36  br label %exit
37exit:
38  ret void
39}
40;.
41; CHECK: attributes #[[ATTR0:[0-9]+]] = { nounwind }
42;.
43; CHECK: [[META0]] = !{i64 6699318081062747564}
44;.
45