[PATCH] D82205: InlineCost - method ::print() to allow dump of statistics to non-debug builds

Kirill Naumov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 11:50:12 PDT 2020


knaumov updated this revision to Diff 272510.
knaumov added a comment.

- Because print() performs the same functionality as did dump(), instead of copying the code just call print() from dump()


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

https://reviews.llvm.org/D82205

Files:
  llvm/lib/Analysis/InlineCost.cpp


Index: llvm/lib/Analysis/InlineCost.cpp
===================================================================
--- llvm/lib/Analysis/InlineCost.cpp
+++ llvm/lib/Analysis/InlineCost.cpp
@@ -726,6 +726,10 @@
 
   void dump();
 
+  // Prints the same analysis as dump(), but its definition is not dependent
+  // on the build.
+  void print();
+
   Optional<InstructionCostDetail> getCostDetails(const Instruction *I) {
     if (InstructionCostDetailMap.find(I) != InstructionCostDetailMap.end())
       return InstructionCostDetailMap[I];
@@ -2167,9 +2171,7 @@
   return finalizeAnalysis();
 }
 
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-/// Dump stats about this call's analysis.
-LLVM_DUMP_METHOD void InlineCostCallAnalyzer::dump() {
+void InlineCostCallAnalyzer::print() {
 #define DEBUG_PRINT_STAT(x) dbgs() << "      " #x ": " << x << "\n"
   if (PrintInstructionComments)
     F.print(dbgs(), &Writer);
@@ -2188,6 +2190,12 @@
   DEBUG_PRINT_STAT(Threshold);
 #undef DEBUG_PRINT_STAT
 }
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+/// Dump stats about this call's analysis.
+LLVM_DUMP_METHOD void InlineCostCallAnalyzer::dump() {
+  print();
+}
 #endif
 
 /// Test that there are no attribute conflicts between Caller and Callee


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82205.272510.patch
Type: text/x-patch
Size: 1250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200622/fa2f5e8c/attachment.bin>


More information about the llvm-commits mailing list