[PATCH] D71733: [NFC][InlineCost] Factor cost modeling out of CallAnalyzer traversal.

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 10:38:14 PST 2019


davidxl added inline comments.


================
Comment at: llvm/lib/Analysis/InlineCost.cpp:134
+  /// Called at the end of the analysis of the callsite
+  virtual InlineResult finalizeAnalysis() { return true; }
+  /// Called when we're about to start processing a basic block, and every time
----------------
Document what to return.


================
Comment at: llvm/lib/Analysis/InlineCost.cpp:141
+  /// Called before analysis starts for a call site.
+  virtual InlineResult onAnalysisStart() { return true; }
+  /// Called if we can't expect SROA optimization for the given alloca value.
----------------
Called before the analysis of the callee body (with callsite contexts propagate) starts.  It checks callsites specific information.

ALso document what to return.


================
Comment at: llvm/lib/Analysis/InlineCost.cpp:143
+  /// Called if we can't expect SROA optimization for the given alloca value.
+  virtual void onDisableSROA(AllocaInst *Arg) {}
+  /// Called if we can't expect load elimination.
----------------
Called when the analysis engine decides that SROA can not be done.  


================
Comment at: llvm/lib/Analysis/InlineCost.cpp:145
+  /// Called if we can't expect load elimination.
+  virtual void onDisableLoadElimination() {}
+  /// Called to account for a call.
----------------
Called by the analysis when load elimination can not happen.


================
Comment at: llvm/lib/Analysis/InlineCost.cpp:152
+  /// Called to account for the cost of argument setup.
+  virtual void onCallArgumentSetup(const CallBase &Call) {}
+  /// Called to account for a load relative intrinsic.
----------------
Make a note that 'Call' is a callsite in the callee body -- not to be confused with the callsite being analyzed.


================
Comment at: llvm/lib/Analysis/InlineCost.cpp:167
+  /// number of case clusters.
+  virtual void onSwitch(unsigned NumCaseCluster) {}
+  /// Called to account for any other instruction not specifically accounted
----------------
onFinalizeSwitch


================
Comment at: llvm/lib/Analysis/InlineCost.cpp:176
+  /// normal call instead.
+  virtual bool handleIndirectCall(Function &F, CallBase &Call) { return false; }
+
----------------
analyzeIndirectCall


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71733





More information about the llvm-commits mailing list