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

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 15:10:02 PST 2015


chandlerc added a comment.

Thanks Easwaran, this seems like a really nice clean up. Just one minor fix needed below...


================
Comment at: lib/Transforms/IPO/InlineSimple.cpp:57-59
@@ +56,5 @@
+    assert(Callee);
+    TargetTransformInfo &TTI =
+        getAnalysis<TargetTransformInfoWrapperPass>().getTTI(*Callee);
+    AssumptionCacheTracker *ACT = &getAnalysis<AssumptionCacheTracker>();
+
----------------
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>();
   Inliner::getAnalysisUsage(AU);
----------------
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...


Repository:
  rL LLVM

http://reviews.llvm.org/D15701





More information about the llvm-commits mailing list