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

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 17:16:23 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;
----------------
WenleiHe wrote:

Looking at it more closely, this actually makes `SampleThreshold` smaller by 100 (`CSPreinlMultiplierForPrevInl`) for the hot path.. which is not intended for the original change? 

Maybe we should just +1 for the cold path.. 

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


More information about the llvm-commits mailing list