[PATCH] D15701: Refactor inline costs analysis by removing the InlineCostAnalysis class

Easwaran Raman via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 15:25:01 PST 2015

eraman added inline comments.

Comment at: lib/Transforms/IPO/InlineSimple.cpp:57-59
@@ +56,5 @@
+    assert(Callee);
+    TargetTransformInfo &TTI =
+        getAnalysis<TargetTransformInfoWrapperPass>().getTTI(*Callee);
+    AssumptionCacheTracker *ACT = &getAnalysis<AssumptionCacheTracker>();
chandlerc wrote:
> These are actually expensive operations. Instead of doing this once per getInlineCost, it would be better to cache them in members of the actual pass (either the SimpleInliner or Inliner depending on what is cleanest).

Comment at: lib/Transforms/IPO/InlineSimple.cpp:108-111
@@ -102,3 +107,6 @@
 void SimpleInliner::getAnalysisUsage(AnalysisUsage &AU) const {
-  AU.addRequired<InlineCostAnalysis>();
+  // TargetTransformInfoWrapperPass and AssumptionCacheTracker are
+  // needed to perform inline cost analysis. The base Inliner class
+  // calls addRequired on AssumptionCacheTracker.
+  AU.addRequired<TargetTransformInfoWrapperPass>();
chandlerc wrote:
> Hmm, this makes me believe that at least the base class should manage calling 'getAnalysis' for AssumptionCacheTracker, and probably this class should do so for TargetTransformInfo...
Not fully sure what you mean here. The base class calls getAnalysis for AssumptionCacheTracker, and you want to cache the value in the base class so that it could be used in derived class's InlineCost?



More information about the llvm-commits mailing list