85 lines · plain
1;; This test verifies 'auto' hotness threshold when profile summary is available.2;;3;; new PM4; RUN: rm -f %t.yaml %t.hot.yaml5; RUN: opt < %s --disable-output \6; RUN: --passes='inline' \7; RUN: --pass-remarks-output=%t.yaml --pass-remarks-filter='inline' \8; RUN: --pass-remarks-with-hotness9; RUN: FileCheck %s -check-prefix=YAML-PASS < %t.yaml10; RUN: FileCheck %s -check-prefix=YAML-MISS < %t.yaml11 12;; test 'auto' threshold13; RUN: opt < %s --disable-output --inline-enable-cost-benefit-analysis=0 \14; RUN: --passes='module(print-profile-summary,cgscc(inline))' \15; RUN: --pass-remarks-output=%t.hot.yaml --pass-remarks-filter='inline' \16; RUN: --pass-remarks-with-hotness --pass-remarks-hotness-threshold=auto 2>&1 | FileCheck %s17; RUN: FileCheck %s -check-prefix=YAML-PASS < %t.hot.yaml18; RUN: not FileCheck %s -check-prefix=YAML-MISS < %t.hot.yaml19 20; RUN: opt < %s --disable-output --inline-enable-cost-benefit-analysis=0 \21; RUN: --passes='module(print-profile-summary,cgscc(inline))' \22; RUN: --pass-remarks=inline --pass-remarks-missed=inline --pass-remarks-analysis=inline \23; RUN: --pass-remarks-with-hotness --pass-remarks-hotness-threshold=auto 2>&1 | FileCheck %s -check-prefix=CHECK-RPASS24 25; YAML-PASS: --- !Passed26; YAML-PASS-NEXT: Pass: inline27; YAML-PASS-NEXT: Name: Inlined28; YAML-PASS-NEXT: Function: caller129; YAML-PASS-NEXT: Hotness: 40030 31; YAML-MISS: --- !Missed32; YAML-MISS-NEXT: Pass: inline33; YAML-MISS-NEXT: Name: NeverInline34; YAML-MISS-NEXT: Function: caller235; YAML-MISS-NEXT: Hotness: 136 37; CHECK-RPASS: 'callee1' inlined into 'caller1' with (cost=-30, threshold=4500) (hotness: 400)38; CHECK-RPASS-NOT: 'callee2' not inlined into 'caller2' because it should never be inlined (cost=never): noinline function attribute (hotness: 1)39 40define void @callee1() !prof !20 {41; CHECK: callee1 :hot42entry:43 ret void44}45 46; Function Attrs: noinline47define void @callee2() noinline !prof !21 {48; CHECK: callee2 :cold49entry:50 ret void51}52 53define void @caller1() !prof !20 {54; CHECK: caller1 :hot55entry:56 call void @callee1()57 ret void58}59 60define void @caller2() !prof !21 {61; CHECK: caller2 :cold62entry:63 call void @callee2()64 ret void65}66 67!llvm.module.flags = !{!1}68!20 = !{!"function_entry_count", i64 400}69!21 = !{!"function_entry_count", i64 1}70 71!1 = !{i32 1, !"ProfileSummary", !2}72!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}73!3 = !{!"ProfileFormat", !"InstrProf"}74!4 = !{!"TotalCount", i64 10000}75!5 = !{!"MaxCount", i64 10}76!6 = !{!"MaxInternalCount", i64 1}77!7 = !{!"MaxFunctionCount", i64 1000}78!8 = !{!"NumCounts", i64 3}79!9 = !{!"NumFunctions", i64 3}80!10 = !{!"DetailedSummary", !11}81!11 = !{!12, !13, !14}82!12 = !{i32 10000, i64 100, i32 1}83!13 = !{i32 999000, i64 100, i32 1}84!14 = !{i32 999999, i64 1, i32 2}85