Skip to content

Commit 1607e82

Browse files
authored
[InlineCost] Disable cost-benefit when sample based PGO is used (#86626)
#66457 makes InlineCost to use cost-benefit by default, which causes 0.4-0.5% performance regression on multiple internal workloads. See discussions #66457. This pull request reverts it. Co-authored-by: helloguo <[email protected]>
1 parent 6aee1f9 commit 1607e82

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llvm/lib/Analysis/InlineCost.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
800800
return false;
801801
} else {
802802
// Otherwise, require instrumentation profile.
803-
if (!(PSI->hasInstrumentationProfile() || PSI->hasSampleProfile()))
803+
if (!PSI->hasInstrumentationProfile())
804804
return false;
805805
}
806806

llvm/test/Transforms/SampleProfile/remarks-hotness.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
; YAML-PASS: --- !Passed
2626
; YAML-PASS-NEXT: Pass: inline
27-
; YAML-PASS-NEXT: Name: AlwaysInline
27+
; YAML-PASS-NEXT: Name: Inlined
2828
; YAML-PASS-NEXT: DebugLoc: { File: remarks-hotness.cpp, Line: 10, Column: 10 }
2929
; YAML-PASS-NEXT: Function: _Z7caller1v
3030
; YAML-PASS-NEXT: Hotness: 401
@@ -36,7 +36,7 @@
3636
; YAML-MISS-NEXT: Function: _Z7caller2v
3737
; YAML-MISS-NEXT: Hotness: 2
3838

39-
; CHECK-RPASS: '_Z7callee1v' inlined into '_Z7caller1v' with (cost=always): benefit over cost at callsite _Z7caller1v:1:10; (hotness: 401)
39+
; CHECK-RPASS: '_Z7callee1v' inlined into '_Z7caller1v' with (cost=-30, threshold=4500) at callsite _Z7caller1v:1:10; (hotness: 401)
4040
; CHECK-RPASS-NOT: '_Z7callee2v' not inlined into '_Z7caller2v' because it should never be inlined (cost=never): noinline function attribute (hotness: 2)
4141

4242
; ModuleID = 'remarks-hotness.cpp'

0 commit comments

Comments
 (0)