[PATCH] D71501: Cost Annotation Writer for InlineCost

Kirill Naumov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 21 14:48:29 PST 2020


knaumov updated this revision to Diff 246001.
knaumov marked 3 inline comments as done.
knaumov added a comment.

Fixed small inaccuracies
As the patch is done, @apilipenko , can you please push it for me?


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

https://reviews.llvm.org/D71501

Files:
  llvm/lib/Analysis/InlineCost.cpp
  llvm/test/DebugInfo/debuginline-cost-delta.ll


Index: llvm/test/DebugInfo/debuginline-cost-delta.ll
===================================================================
--- llvm/test/DebugInfo/debuginline-cost-delta.ll
+++ llvm/test/DebugInfo/debuginline-cost-delta.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -inline -debug-only=inline-cost -disable-output -print-instruction-delta |& FileCheck %s
+; RUN: opt < %s -inline -debug-only=inline-cost -disable-output -print-instruction-deltas |& FileCheck %s
 
 ; CHECK:       Analyzing call of callee1... (caller:foo)
 ; CHECK: define i32 @callee1(i32 %x) {
Index: llvm/lib/Analysis/InlineCost.cpp
===================================================================
--- llvm/lib/Analysis/InlineCost.cpp
+++ llvm/lib/Analysis/InlineCost.cpp
@@ -53,7 +53,7 @@
                      cl::ZeroOrMore,
                      cl::desc("Default amount of inlining to perform"));
 
-static cl::opt<bool> EnableInstructionDelta("print-instruction-delta",
+static cl::opt<bool> PrintDebugInstructionDeltas("print-instruction-deltas",
     cl::Hidden, cl::init(false),
     cl::desc("Prints deltas of cost and threshold per instruction"));
 
@@ -121,8 +121,8 @@
   // accounting for the given instruction.
   DenseMap <const Instruction *, InstructionCostDetail> CostThresholdMap;
 
-  virtual void emitInstructionAnnot(const llvm::Instruction *I,
-                                    llvm::formatted_raw_ostream &OS);
+  virtual void emitInstructionAnnot(const Instruction *I,
+                                        formatted_raw_ostream &OS);
 };
 
 class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
@@ -573,7 +573,7 @@
   void onInstructionAnalysisStart(const Instruction *I) override {
     // This function is called to store the initial cost of inlining before
     // the given instruction was assessed.
-    if (!EnableInstructionDelta)
+    if (!PrintDebugInstructionDeltas)
         return ;
     Writer.CostThresholdMap[I].CostBefore = Cost;
     Writer.CostThresholdMap[I].ThresholdBefore = Threshold;
@@ -582,7 +582,7 @@
   void onInstructionAnalysisFinish(const Instruction *I) override {
     // This function is called to find new values of cost and threshold after
     // the instruction has been assessed.
-    if (!EnableInstructionDelta)
+    if (!PrintDebugInstructionDeltas)
         return ;
     Writer.CostThresholdMap[I].CostAfter = Cost;
     Writer.CostThresholdMap[I].ThresholdAfter = Threshold;
@@ -1835,8 +1835,7 @@
     // instruction. Visit the instructions using our InstVisitor to account for
     // all of the per-instruction logic. The visit tree returns true if we
     // consumed the instruction in any way, and false if the instruction's base
-    // cost should count against inlining. The deltas are saved for the
-    // CostAnnotationWriter.
+    // cost should count against inlining.
     onInstructionAnalysisStart(&*I);
 
     if (Base::visit(&*I))
@@ -2126,7 +2125,7 @@
 /// Dump stats about this call's analysis.
 LLVM_DUMP_METHOD void InlineCostCallAnalyzer::dump() {
 #define DEBUG_PRINT_STAT(x) dbgs() << "      " #x ": " << x << "\n"
-  if (EnableInstructionDelta)
+  if (PrintDebugInstructionDeltas)
     F.print(dbgs(), &Writer);
   DEBUG_PRINT_STAT(NumConstantArgs);
   DEBUG_PRINT_STAT(NumConstantOffsetPtrArgs);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71501.246001.patch
Type: text/x-patch
Size: 3267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200221/4bdd72ee/attachment.bin>


More information about the llvm-commits mailing list