[PATCH] D39869: [Inliner] Inline through indirect call sites having !callees metadata

Easwaran Raman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 20 18:07:47 PDT 2018


eraman added inline comments.


================
Comment at: lib/Transforms/IPO/Inliner.cpp:447
+  assert(Callee && "Call was not promoted");
+  CallGraphNode *Caller = CG[DirectCS.getInstruction()->getFunction()];
+
----------------
CallSite has a getCaller method. 


================
Comment at: lib/Transforms/IPO/Inliner.cpp:1016
+      Optional<InlineCost> OIC = None;
+      auto ShouldInline = [&](CallSite CS, Function *Callee) {
+        SmallVector<CastInst *, 4> Casts;
----------------
This same code repeats twice.  This can be moved to a static function.  Actually, most of the logic used is common to legacy and new PM (except for the callgraph updating bit) and hence could be consolidated into a separate function. 


================
Comment at: lib/Transforms/IPO/Inliner.cpp:1037
+        auto &Visited = AnalyzedCallees[CS.getInstruction()];
+        Instruction *Direct = tryToPromoteCallSite(CS, Visited, {ShouldInline});
+        if (!Direct)
----------------
There are two other checks (starting at line 1051) that could prevent a callsite from inlining before we call shouldInline. This means it is possible that the promoted call doesn't get inlined. 


Repository:
  rL LLVM

https://reviews.llvm.org/D39869





More information about the llvm-commits mailing list