[PATCH] D37779: Invoke GetInlineCost for legality check before inline functions in SampleProfileLoader.

Easwaran Raman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 16:42:30 PDT 2017


eraman added inline comments.


================
Comment at: lib/Transforms/IPO/SampleProfile.cpp:89
              "collected in the parent function, will be inlined again."));
+static cl::opt<unsigned> SampleProfileInlineHotThreshold(
+    "sample-profile-inline-hot-threshold", cl::init(100000),
----------------
Do you really need an option for this? All you want is to pick a large enough number such that the cost never exceeds the threshold.


================
Comment at: lib/Transforms/IPO/SampleProfile.cpp:765
       }
+      CallSite CS(DI);
+      if (!getInlineCost(CS, getInlineParams(SampleProfileInlineHotThreshold),
----------------
This needs detailed comments. State that you want to check if there is anything in the reachable portion of the callee at this callsite that makes this inlining potentially illegal and that's why you use a large threshold (large enough to return true in ~all cases except when it is potentially incorrect)


================
Comment at: lib/Transforms/IPO/SampleProfile.cpp:766
+      CallSite CS(DI);
+      if (!getInlineCost(CS, getInlineParams(SampleProfileInlineHotThreshold),
+                         GetTTI(*CalledFunction), GetAC, None, nullptr,
----------------
Differentiate  the InlineCost::isNever and the case where cost exceeds threshold.  It is useful to log the latter case for debugging. 


https://reviews.llvm.org/D37779





More information about the llvm-commits mailing list