[polly] ad568f4 - [Polly] Add support for -polly-dump-after(-file) with the NPM.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Mon May 17 20:22:30 PDT 2021


Author: Michael Kruse
Date: 2021-05-17T22:20:47-05:00
New Revision: ad568f4286c9a46e81475aee4ff9ecfe082e2ec0

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

LOG: [Polly] Add support for -polly-dump-after(-file) with the NPM.

For the same reason as with -polly-dump-before, it is only supported
with -polly-position=early.

Added: 
    

Modified: 
    polly/lib/Support/RegisterPasses.cpp
    polly/test/Support/dumpmodule.ll

Removed: 
    


################################################################################
diff  --git a/polly/lib/Support/RegisterPasses.cpp b/polly/lib/Support/RegisterPasses.cpp
index 99144b87090f..0c3b6fe51e62 100644
--- a/polly/lib/Support/RegisterPasses.cpp
+++ b/polly/lib/Support/RegisterPasses.cpp
@@ -569,13 +569,6 @@ static void buildCommonPollyPipeline(FunctionPassManager &PM,
   PM.addPass(PB.buildFunctionSimplificationPipeline(
       Level, ThinOrFullLTOPhase::None)); // Cleanup
 
-  if (DumpAfter)
-    report_fatal_error("Option -polly-dump-after not supported with NPM",
-                       false);
-  if (!DumpAfterFile.empty())
-    report_fatal_error("Option -polly-dump-after-file not supported with NPM",
-                       false);
-
   if (CFGPrinter)
     PM.addPass(llvm::CFGPrinterPass());
 }
@@ -602,6 +595,11 @@ static void buildEarlyPollyPipeline(ModulePassManager &MPM,
 
   buildCommonPollyPipeline(FPM, Level, EnableForOpt);
   MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
+
+  if (DumpAfter)
+    MPM.addPass(DumpModulePass("-after", true));
+  for (auto &Filename : DumpAfterFile)
+    MPM.addPass(DumpModulePass(Filename, false));
 }
 
 static void buildLatePollyPipeline(FunctionPassManager &PM,
@@ -619,6 +617,13 @@ static void buildLatePollyPipeline(FunctionPassManager &PM,
                        false);
 
   buildCommonPollyPipeline(PM, Level, EnableForOpt);
+
+  if (DumpAfter)
+    report_fatal_error("Option -polly-dump-after not supported with NPM",
+                       false);
+  if (!DumpAfterFile.empty())
+    report_fatal_error("Option -polly-dump-after-file not supported with NPM",
+                       false);
 }
 
 /// Register Polly to be available as an optimizer

diff  --git a/polly/test/Support/dumpmodule.ll b/polly/test/Support/dumpmodule.ll
index c3a15066c700..366c2c50fef4 100644
--- a/polly/test/Support/dumpmodule.ll
+++ b/polly/test/Support/dumpmodule.ll
@@ -1,9 +1,12 @@
 ; Legacy pass manager
-; RUN: opt %loadPolly -enable-new-pm=0 -O3 -polly -polly-position=early             -polly-dump-before-file=%t-legacy-early.ll --disable-output < %s && FileCheck --input-file=%t-legacy-early.ll --check-prefix=EARLY %s
-; RUN: opt %loadPolly -enable-new-pm=0 -O3 -polly -polly-position=before-vectorizer -polly-dump-before-file=%t-legacy-late.ll  --disable-output < %s && FileCheck --input-file=%t-legacy-late.ll  --check-prefix=LATE  %s
-;
+; RUN: opt %loadPolly -enable-new-pm=0 -O3 -polly -polly-position=early             -polly-dump-before-file=%t-legacy-before-early.ll --disable-output < %s && FileCheck --input-file=%t-legacy-before-early.ll --check-prefix=EARLY  %s
+; RUN: opt %loadPolly -enable-new-pm=0 -O3 -polly -polly-position=before-vectorizer -polly-dump-before-file=%t-legacy-before-late.ll  --disable-output < %s && FileCheck --input-file=%t-legacy-before-late.ll  --check-prefix=LATE   %s
+; RUN: opt %loadPolly -enable-new-pm=0 -O3 -polly -polly-position=early             -polly-dump-after-file=%t-legacy-after-early.ll   --disable-output < %s && FileCheck --input-file=%t-legacy-after-early.ll  --check-prefix=EARLY --check-prefix=AFTEREARLY %s
+; RUN: opt %loadPolly -enable-new-pm=0 -O3 -polly -polly-position=before-vectorizer -polly-dump-after-file=%t-legacy-after-late.ll    --disable-output < %s && FileCheck --input-file=%t-legacy-after-late.ll   --check-prefix=LATE  --check-prefix=AFTERLATE  %s
+;-
 ; New pass manager
-; RUN: opt %loadPolly -enable-new-pm=1 -O3 -polly -polly-position=early             -polly-dump-before-file=%t-npm-early.ll    --disable-output < %s && FileCheck --input-file=%t-npm-early.ll    --check-prefix=EARLY  %s
+; RUN: opt %loadPolly -enable-new-pm=1 -O3 -polly -polly-position=early             -polly-dump-before-file=%t-npm-before-early.ll    --disable-output < %s && FileCheck --input-file=%t-npm-before-early.ll    --check-prefix=EARLY %s
+; RUN: opt %loadPolly -enable-new-pm=1 -O3 -polly -polly-position=early             -polly-dump-after-file=%t-npm-after-early.ll      --disable-output < %s && FileCheck --input-file=%t-npm-after-early.ll     --check-prefix=EARLY --check-prefix=AFTEREARLY %s
 ;
 ; Check the module dumping before Polly at specific positions in the
 ; pass pipeline.
@@ -72,9 +75,11 @@ return:
 
 
 ; EARLY-LABEL: @callee(
+; AFTEREARLY:  polly.split_new_and_old:
 ; EARLY:         store double 4.200000e+01, double* %arrayidx
 ; EARLY-LABEL: @caller(
 ; EARLY:         call void @callee(
 
 ; LATE-LABEL: @caller(
+; AFTERLATE:  polly.split_new_and_old:
 ; LATE:          store double 4.200000e+01, double* %arrayidx


        


More information about the llvm-commits mailing list