From c0022b4bb12d93d95bc3dfa00f236fc2cfe753ed Mon Sep 17 00:00:00 2001 From: Jun Ma Date: Fri, 22 Apr 2022 15:08:01 +0800 Subject: [PATCH] [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 --- llvm/lib/Analysis/InlineCost.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index 033ca9a8ecde..837a6c1eafd0 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -1203,6 +1203,10 @@ private: 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