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

Lei Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 13:45:29 PDT 2024


================
@@ -152,6 +152,9 @@ uint32_t CSPreInliner::getFuncSize(const ContextTrieNode *ContextNode) {
 }
 
 bool CSPreInliner::shouldInline(ProfiledInlineCandidate &Candidate) {
+  if (Candidate.SizeCost == 0)
+    return true;
+
----------------
wlei-llvm wrote:

I saw `    SampleThreshold = SampleHotCallSiteThreshold * NormalizedHotness * 100 +
                      SampleColdCallSiteThreshold + 1;`, it should be > 0 number, so IIUC, the zero is from  `SampleColdCallSiteThreshold` which is set by default to zero. I wondering if we can just set it to 1, so we don't need an additional condition here. No strong option. 
                    

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


More information about the llvm-commits mailing list