[PATCH] D82511: [NewPM] Move debugging log printing after PassInstrumentation before-pass-callbacks

Yuanfang Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 24 21:10:08 PDT 2020


ychen updated this revision to Diff 273224.
ychen added a comment.
Herald added a subscriber: hiraditya.

- Missed two more similar cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82511

Files:
  llvm/include/llvm/IR/PassManager.h
  llvm/lib/Analysis/CGSCCPassManager.cpp
  llvm/lib/Transforms/Scalar/LoopPassManager.cpp


Index: llvm/lib/Transforms/Scalar/LoopPassManager.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopPassManager.cpp
+++ llvm/lib/Transforms/Scalar/LoopPassManager.cpp
@@ -34,14 +34,14 @@
   // instrumenting callbacks for the passes later.
   PassInstrumentation PI = AM.getResult<PassInstrumentationAnalysis>(L, AR);
   for (auto &Pass : Passes) {
-    if (DebugLogging)
-      dbgs() << "Running pass: " << Pass->name() << " on " << L;
-
     // Check the PassInstrumentation's BeforePass callbacks before running the
     // pass, skip its execution completely if asked to (callback returns false).
     if (!PI.runBeforePass<Loop>(*Pass, L))
       continue;
 
+    if (DebugLogging)
+      dbgs() << "Running pass: " << Pass->name() << " on " << L;
+
     PreservedAnalyses PassPA;
     {
       TimeTraceScope TimeScope(Pass->name(), L.getName());
Index: llvm/lib/Analysis/CGSCCPassManager.cpp
===================================================================
--- llvm/lib/Analysis/CGSCCPassManager.cpp
+++ llvm/lib/Analysis/CGSCCPassManager.cpp
@@ -73,14 +73,14 @@
       AM.getCachedResult<FunctionAnalysisManagerCGSCCProxy>(*C)->getManager();
 
   for (auto &Pass : Passes) {
-    if (DebugLogging)
-      dbgs() << "Running pass: " << Pass->name() << " on " << *C << "\n";
-
     // Check the PassInstrumentation's BeforePass callbacks before running the
     // pass, skip its execution completely if asked to (callback returns false).
     if (!PI.runBeforePass(*Pass, *C))
       continue;
 
+    if (DebugLogging)
+      dbgs() << "Running pass: " << Pass->name() << " on " << *C << "\n";
+
     PreservedAnalyses PassPA;
     {
       TimeTraceScope TimeScope(Pass->name());
Index: llvm/include/llvm/IR/PassManager.h
===================================================================
--- llvm/include/llvm/IR/PassManager.h
+++ llvm/include/llvm/IR/PassManager.h
@@ -503,9 +503,6 @@
 
     for (unsigned Idx = 0, Size = Passes.size(); Idx != Size; ++Idx) {
       auto *P = Passes[Idx].get();
-      if (DebugLogging)
-        dbgs() << "Running pass: " << P->name() << " on " << IR.getName()
-               << "\n";
 
       // Check the PassInstrumentation's BeforePass callbacks before running the
       // pass, skip its execution completely if asked to (callback returns
@@ -513,6 +510,10 @@
       if (!PI.runBeforePass<IRUnitT>(*P, IR))
         continue;
 
+      if (DebugLogging)
+        dbgs() << "Running pass: " << P->name() << " on " << IR.getName()
+               << "\n";
+
       PreservedAnalyses PassPA;
       {
         TimeTraceScope TimeScope(P->name(), IR.getName());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82511.273224.patch
Type: text/x-patch
Size: 2669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200625/2d19415b/attachment-0001.bin>


More information about the llvm-commits mailing list