[llvm] r301574 - Memory intrinsic value profile optimization: Improve debug output (NFC)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 11:25:22 PDT 2017


Author: tejohnson
Date: Thu Apr 27 13:25:22 2017
New Revision: 301574

URL: http://llvm.org/viewvc/llvm-project?rev=301574&view=rev
Log:
Memory intrinsic value profile optimization: Improve debug output (NFC)

Summary:
Misc improvements to debug output. Fix a couple typos and also dump the
value profile before we make any profitability checks.

Reviewers: davidxl

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D32607

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp

Modified: llvm/trunk/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp?rev=301574&r1=301573&r2=301574&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp Thu Apr 27 13:25:22 2017
@@ -771,7 +771,7 @@ public:
       if (perform(MI)) {
         Changed = true;
         ++NumOfPGOMemOPOpt;
-        DEBUG(dbgs() << "MemOP calls: " << MI->getCalledFunction()->getName()
+        DEBUG(dbgs() << "MemOP call: " << MI->getCalledFunction()->getName()
                      << "is Transformed.\n");
       }
     }
@@ -863,13 +863,19 @@ bool MemOPSizeOpt::perform(MemIntrinsic
     ActualCount = *BBEdgeCount;
   }
 
+  ArrayRef<InstrProfValueData> VDs(ValueDataArray.get(), NumVals);
+  DEBUG(dbgs() << "Read one memory intrinsic profile with count " << ActualCount
+               << "\n");
+  DEBUG(
+      for (auto &VD
+           : VDs) { dbgs() << "  (" << VD.Value << "," << VD.Count << ")\n"; });
+
   if (ActualCount < MemOPCountThreshold)
     return false;
 
-  ArrayRef<InstrProfValueData> VDs(ValueDataArray.get(), NumVals);
   TotalCount = ActualCount;
   if (MemOPScaleCount)
-    DEBUG(dbgs() << "Scale counts: numberator = " << ActualCount
+    DEBUG(dbgs() << "Scale counts: numerator = " << ActualCount
                  << " denominator = " << SavedTotalCount << "\n");
 
   // Keeping track of the count of the default case:
@@ -915,14 +921,10 @@ bool MemOPSizeOpt::perform(MemIntrinsic
     MaxCount = RemainCount;
 
   uint64_t SumForOpt = TotalCount - RemainCount;
-  DEBUG(dbgs() << "Read one memory intrinsic profile: " << SumForOpt << " vs "
-               << TotalCount << "\n");
-  DEBUG(
-      for (auto &VD
-           : VDs) { dbgs() << "  (" << VD.Value << "," << VD.Count << ")\n"; });
 
   DEBUG(dbgs() << "Optimize one memory intrinsic call to " << Version
-               << " Versions\n");
+               << " Versions (covering " << SumForOpt << " out of "
+               << TotalCount << ")\n");
 
   // mem_op(..., size)
   // ==>




More information about the llvm-commits mailing list