aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiangyang (Mark) Guo <helloguo@fb.com>2024-03-28 10:11:57 -0700
committerGitHub <noreply@github.com>2024-03-28 10:11:57 -0700
commit1607e8212caa7c050d89b5b143531edb815ec7f3 (patch)
treecfc3107bb4eaf558bea864a7b6c47530a41137b0
parent6aee1f9d1833f7ac000f6451a5d440b3a321a557 (diff)
downloadllvm-1607e8212caa7c050d89b5b143531edb815ec7f3.zip
llvm-1607e8212caa7c050d89b5b143531edb815ec7f3.tar.gz
llvm-1607e8212caa7c050d89b5b143531edb815ec7f3.tar.bz2
[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 https://github.com/llvm/llvm-project/pull/66457. This pull request reverts it. Co-authored-by: helloguo <helloguo@meta.com>
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp2
-rw-r--r--llvm/test/Transforms/SampleProfile/remarks-hotness.ll4
2 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index e55eaa5..c75460f 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -800,7 +800,7 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
return false;
} else {
// Otherwise, require instrumentation profile.
- if (!(PSI->hasInstrumentationProfile() || PSI->hasSampleProfile()))
+ if (!PSI->hasInstrumentationProfile())
return false;
}
diff --git a/llvm/test/Transforms/SampleProfile/remarks-hotness.ll b/llvm/test/Transforms/SampleProfile/remarks-hotness.ll
index b90b21e..36fb3c5 100644
--- a/llvm/test/Transforms/SampleProfile/remarks-hotness.ll
+++ b/llvm/test/Transforms/SampleProfile/remarks-hotness.ll
@@ -24,7 +24,7 @@
; YAML-PASS: --- !Passed
; YAML-PASS-NEXT: Pass: inline
-; YAML-PASS-NEXT: Name: AlwaysInline
+; YAML-PASS-NEXT: Name: Inlined
; YAML-PASS-NEXT: DebugLoc: { File: remarks-hotness.cpp, Line: 10, Column: 10 }
; YAML-PASS-NEXT: Function: _Z7caller1v
; YAML-PASS-NEXT: Hotness: 401
@@ -36,7 +36,7 @@
; YAML-MISS-NEXT: Function: _Z7caller2v
; YAML-MISS-NEXT: Hotness: 2
-; CHECK-RPASS: '_Z7callee1v' inlined into '_Z7caller1v' with (cost=always): benefit over cost at callsite _Z7caller1v:1:10; (hotness: 401)
+; CHECK-RPASS: '_Z7callee1v' inlined into '_Z7caller1v' with (cost=-30, threshold=4500) at callsite _Z7caller1v:1:10; (hotness: 401)
; CHECK-RPASS-NOT: '_Z7callee2v' not inlined into '_Z7caller2v' because it should never be inlined (cost=never): noinline function attribute (hotness: 2)
; ModuleID = 'remarks-hotness.cpp'