xref: /llvm-project/llvm/test/Transforms/SampleProfile/csspgo-inline-icall.ll (revision 0271ae65a66367d802fa6866599d11e35f68450f)
1f0d41b58Swlei; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/indirect-call-csspgo.prof -sample-profile-icp-relative-hotness=1  -pass-remarks=sample-profile -S -o /dev/null 2>&1 | FileCheck -check-prefix=ICP-ALL %s
2f0d41b58Swlei; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/indirect-call-csspgo.prof -sample-profile-icp-relative-hotness=1  -pass-remarks=sample-profile -sample-profile-inline-size=0 -S -o /dev/null 2>&1 | FileCheck -check-prefix=ICP-HOT %s
37ca80300SHongtao Yu; RUN: llvm-profdata merge --sample --extbinary --use-md5 %S/Inputs/indirect-call-csspgo.prof -o %t.md5
47ca80300SHongtao Yu; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.md5 -sample-profile-icp-relative-hotness=1  -pass-remarks=sample-profile -sample-profile-inline-size=0 -S -o /dev/null 2>&1 | FileCheck -check-prefix=ICP-HOT %s
57ca80300SHongtao Yu
66bae5973SWenlei He
7*0271ae65SFangrui Songdefine void @test(ptr) #0 !dbg !3 {
86bae5973SWenlei He;; Add two direct call to force top-down order for sample profile loader
96bae5973SWenlei He  call void @_Z3foov(), !dbg !7
106bae5973SWenlei He  call void @_Z3barv(), !dbg !7
116bae5973SWenlei He  call void @_Z3bazv(), !dbg !7
12*0271ae65SFangrui Song  %2 = alloca ptr
13*0271ae65SFangrui Song  store ptr %0, ptr %2
14*0271ae65SFangrui Song  %3 = load ptr, ptr %2
156bae5973SWenlei He  call void %3(), !dbg !4
16*0271ae65SFangrui Song  %4 = alloca ptr
17*0271ae65SFangrui Song  store ptr %0, ptr %4
18*0271ae65SFangrui Song  %5 = load ptr, ptr %4
196bae5973SWenlei He  call void %5(), !dbg !5
206bae5973SWenlei He  ret void
216bae5973SWenlei He}
226bae5973SWenlei He
236bae5973SWenlei Hedefine void @_Z3foov() #0 !dbg !8 {
246bae5973SWenlei He  ret void
256bae5973SWenlei He}
266bae5973SWenlei He
276bae5973SWenlei Hedefine void @_Z3barv() #0 !dbg !9 {
286bae5973SWenlei He  ret void
296bae5973SWenlei He}
306bae5973SWenlei He
316bae5973SWenlei Hedefine void @_Z3bazv() #0 !dbg !10 {
326bae5973SWenlei He  ret void
336bae5973SWenlei He}
346bae5973SWenlei He
356bae5973SWenlei Hedefine void @_Z3zoov() #0 !dbg !11 {
366bae5973SWenlei He  ret void
376bae5973SWenlei He}
386bae5973SWenlei He
396bae5973SWenlei Heattributes #0 = {"use-sample-profile"}
406bae5973SWenlei He
416bae5973SWenlei He!llvm.dbg.cu = !{!0}
426bae5973SWenlei He!llvm.module.flags = !{!2}
436bae5973SWenlei He
446bae5973SWenlei He!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1)
456bae5973SWenlei He!1 = !DIFile(filename: "test.cc", directory: "/")
466bae5973SWenlei He!2 = !{i32 2, !"Debug Info Version", i32 3}
476bae5973SWenlei He!3 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 3, unit: !0)
486bae5973SWenlei He!4 = !DILocation(line: 4, scope: !3)
496bae5973SWenlei He!5 = !DILocation(line: 5, scope: !3)
506bae5973SWenlei He!6 = !DILocation(line: 6, scope: !3)
516bae5973SWenlei He!7 = !DILocation(line: 7, scope: !3)
526bae5973SWenlei He!8 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 29, unit: !0)
536bae5973SWenlei He!9 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barv", scope: !1, file: !1, line: 32, unit: !0)
546bae5973SWenlei He!10 = distinct !DISubprogram(name: "baz", linkageName: "_Z3bazv", scope: !1, file: !1, line: 24, unit: !0)
556bae5973SWenlei He!11 = distinct !DISubprogram(name: "zoo", linkageName: "_Z3zoov", scope: !1, file: !1, line: 24, unit: !0)
566bae5973SWenlei He
576bae5973SWenlei He
5807846e33SHongtao Yu; ICP-ALL:      remark: test.cc:4:0: '_Z3foov' inlined into 'test'
5976093b17SFangrui Song; ICP-ALL-NEXT: remark: test.cc:4:0: '_Z3barv' inlined into 'test'
6007846e33SHongtao Yu; ICP-ALL-NEXT: remark: test.cc:5:0: '_Z3bazv' inlined into 'test'
616bae5973SWenlei He; ICP-ALL-NOT: remark
626bae5973SWenlei He
6376093b17SFangrui Song; ICP-HOT: remark: test.cc:4:0: '_Z3foov' inlined into 'test'
646bae5973SWenlei He; ICP-HOT-NOT: remark
65