[PATCH] D32008: [SampleProfile] Skip intrinsic calls when visiting callsites in InlineHotFunctions. NFC.

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 05:02:06 PDT 2017


andreadb created this revision.

Intrinsic calls like llvm.dbg.value() should not be considered as viable candidates for inlining.

Before this patch, we always called method 'findCalleeFunctionSamples()' on intrinsic calls.

However, an intrinsic call (for example: a @llvm.dbg.value()) can have the same debug location of another function F which, according to the sample profile, was originally inlined.

In that scenario, method 'findCalleeFunctionSamples()' would return a non-null pointer, and the algorithm would end up adding the intrinsic call to the 'Candidates' set.

As a side note: I noticed that Dehao created https://reviews.llvm.org/D31950. With that patch, intrinsic calls would not be added to the Candidates set, because that patch would introduce a check on the function name.

That said, in the case of intrinsic calls, we shouldn't even call 'findCalleeFunctionSamples()', since intrinsic calls cannot be considered as viable inlining candidates fof obvious reasons.

Please let me know if okay to commit.

Thanks,
Andrea


https://reviews.llvm.org/D32008

Files:
  lib/Transforms/IPO/SampleProfile.cpp


Index: lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- lib/Transforms/IPO/SampleProfile.cpp
+++ lib/Transforms/IPO/SampleProfile.cpp
@@ -623,7 +623,7 @@
       for (auto &I : BB.getInstList()) {
         const FunctionSamples *FS = nullptr;
         if ((isa<CallInst>(I) || isa<InvokeInst>(I)) &&
-            (FS = findCalleeFunctionSamples(I))) {
+            !isa<IntrinsicInst>(I) && (FS = findCalleeFunctionSamples(I))) {
           Candidates.push_back(&I);
           if (callsiteIsHot(Samples, FS))
             Hot = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32008.95102.patch
Type: text/x-patch
Size: 594 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170413/7db58cb4/attachment.bin>


More information about the llvm-commits mailing list