[llvm] c4b1dae - [NewPM] Move debugging log printing after PassInstrumentation before-pass-callbacks

Yuanfang Chen via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 10:03:41 PDT 2020


Author: Yuanfang Chen
Date: 2020-06-25T10:03:25-07:00
New Revision: c4b1daed1d6adfa726682ab4576f0f4a07ccdeac

URL: https://github.com/llvm/llvm-project/commit/c4b1daed1d6adfa726682ab4576f0f4a07ccdeac
DIFF: https://github.com/llvm/llvm-project/commit/c4b1daed1d6adfa726682ab4576f0f4a07ccdeac.diff

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

For passes got skipped, this is confusing because the log said it is `running pass`
but it is skipped later.

Reviewed By: asbirlea

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h
index e7fb0b5e7543..4d5f292ba9a1 100644
--- a/llvm/include/llvm/IR/PassManager.h
+++ b/llvm/include/llvm/IR/PassManager.h
@@ -503,9 +503,6 @@ class PassManager : public PassInfoMixin<
 
     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 @@ class PassManager : public PassInfoMixin<
       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());

diff  --git a/llvm/lib/Analysis/CGSCCPassManager.cpp b/llvm/lib/Analysis/CGSCCPassManager.cpp
index 64bd6dfe67ab..fd3166f8cd0c 100644
--- a/llvm/lib/Analysis/CGSCCPassManager.cpp
+++ b/llvm/lib/Analysis/CGSCCPassManager.cpp
@@ -73,14 +73,14 @@ PassManager<LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &,
       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());

diff  --git a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
index cc083c2fae70..98889a9df116 100644
--- a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
@@ -34,14 +34,14 @@ PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &,
   // 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());


        


More information about the llvm-commits mailing list