[llvm] c0022b4 - [InlineCost] Set LastCallToStaticBonus in ML inlining models.

Jun Ma via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 23 18:34:33 PDT 2022


Author: Jun Ma
Date: 2022-04-24T09:34:19+08:00
New Revision: c0022b4bb12d93d95bc3dfa00f236fc2cfe753ed

URL: https://github.com/llvm/llvm-project/commit/c0022b4bb12d93d95bc3dfa00f236fc2cfe753ed
DIFF: https://github.com/llvm/llvm-project/commit/c0022b4bb12d93d95bc3dfa00f236fc2cfe753ed.diff

LOG: [InlineCost] Set LastCallToStaticBonus in ML inlining models.

This patch set LastCallToStaticBonus based on check, it has
no noticeable size reduction on an internal workload and linux kernel
with Os/Oz.

Differential Revision: https://reviews.llvm.org/D124233

Added: 
    

Modified: 
    llvm/lib/Analysis/InlineCost.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 033ca9a8ecdec..837a6c1eafd00 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -1203,6 +1203,10 @@ class InlineCostFeaturesAnalyzer final : public CallAnalyzer {
     set(InlineCostFeatureIndex::ColdCcPenalty,
         (F.getCallingConv() == CallingConv::Cold));
 
+    set(InlineCostFeatureIndex::LastCallToStaticBonus,
+        (F.hasLocalLinkage() && F.hasOneLiveUse() &&
+         &F == CandidateCall.getCalledFunction()));
+
     // FIXME: we shouldn't repeat this logic in both the Features and Cost
     // analyzer - instead, we should abstract it to a common method in the
     // CallAnalyzer


        


More information about the llvm-commits mailing list