[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:49:46 PST 2015

chandlerc added inline comments.

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>();
eraman wrote:
> 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?
Yea, just make a protected member that the derived class can access when calling getInlineCost so it doesn't have to call getAnalysis again.

(The fact that this is somewhat magical is one of many reasons why I don't really like the pattern SimpleInliner AlwaysInliner use of subclassing a fully formed pass, but I think that's a much bigger refactoring yak to shave)



More information about the llvm-commits mailing list