[PATCH] D115545: [Inline] Attempt to delete any discardable if unused functions

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 08:35:21 PST 2022


mtrofin accepted this revision.
mtrofin added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/Inliner.cpp:967
+          } else {
+            DeadFunctionsInComdats.push_back(&Callee);
+          }
----------------
nikic wrote:
> mtrofin wrote:
> > can you make `Advice->recordInliningWithCalleeDeleted` happen in this case, too?
> I'm not sure that would be the right modelling. I believe the reasoning here is that even if we drop a linkonce_odr function in this module, there may be many other modules that also define the same function. It will only be really deleted if it is deleted from *all* modules. Otherwise dropping it in just one module has no effect after linking. I think this is why the inlining cost model does not apply the last call to local to linkonce_odr functions. And I would expect that the advisor would follow similar reasoning.
It would hint to the ML Advisor (during training) that it did "a good thing" because, locally, at this module level, we did the best we could have for such a function (i.e. deleted it). But we can try this first ourselves and see if it significantly helps or not.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115545/new/

https://reviews.llvm.org/D115545



More information about the llvm-commits mailing list