[llvm] [Preinliner] Always inline when SizeCost is zero (PR #88785)

Hongtao Yu via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 17:25:31 PDT 2024


================
@@ -179,11 +179,8 @@ bool CSPreInliner::shouldInline(ProfiledInlineCandidate &Candidate) {
         (NormalizationUpperBound - NormalizationLowerBound);
     if (NormalizedHotness > 1.0)
       NormalizedHotness = 1.0;
-    // Add 1 to ensure hot callsites get a non-zero threshold, which could
-    // happen when SampleColdCallSiteThreshold is 0. This is when we do not
-    // want any inlining for cold callsites.
     SampleThreshold = SampleHotCallSiteThreshold * NormalizedHotness * 100 +
-                      SampleColdCallSiteThreshold + 1;
----------------
htyu wrote:

I encountered similar issue in the past and I went for an alternative that is to increase function size by 1 in `CSPreInliner::processFunction` . Perf win wasn't obvious though.

https://github.com/llvm/llvm-project/pull/88785


More information about the llvm-commits mailing list