[PATCH] D93871: [NewPM] Fix CGSCCOptimizerLateEPCallbacks place in pipeline
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 28 13:19:09 PST 2020
aeubanks created this revision.
aeubanks added reviewers: ychen, asbirlea.
Herald added a subscriber: hiraditya.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
CGSCCOptimizerLateEPCallbacks are supposed to be run before the function
simplification pipeline, like in the legacy PM and as specified in the
comments for registerCGSCCOptimizerLateEPCallback().
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D93871
Files:
llvm/lib/Passes/PassBuilder.cpp
llvm/test/Other/new-pm-defaults.ll
Index: llvm/test/Other/new-pm-defaults.ll
===================================================================
--- llvm/test/Other/new-pm-defaults.ll
+++ llvm/test/Other/new-pm-defaults.ll
@@ -128,6 +128,7 @@
; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
; CHECK-O2-NEXT: Running pass: OpenMPOptPass on (foo)
; CHECK-O3-NEXT: Running pass: OpenMPOptPass on (foo)
+; CHECK-EP-CGSCC-LATE-NEXT: Running pass: NoOpCGSCCPass
; CHECK-O-NEXT: Starting llvm::Function pass manager run.
; CHECK-O-NEXT: Running pass: SROA
; CHECK-O-NEXT: Running pass: EarlyCSEPass
@@ -206,7 +207,6 @@
; CHECK-O-NEXT: Running pass: InstCombinePass
; CHECK-EP-PEEPHOLE-NEXT: Running pass: NoOpFunctionPass
; CHECK-O-NEXT: Finished llvm::Function pass manager run.
-; CHECK-EP-CGSCC-LATE-NEXT: Running pass: NoOpCGSCCPass
; CHECK-O-NEXT: Finished CGSCC pass manager run.
; CHECK-O-NEXT: Finished llvm::Module pass manager run.
; CHECK-O-NEXT: Running pass: GlobalOptPass
Index: llvm/lib/Passes/PassBuilder.cpp
===================================================================
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -986,14 +986,14 @@
if (Level == OptimizationLevel::O2 || Level == OptimizationLevel::O3)
MainCGPipeline.addPass(OpenMPOptPass());
+ for (auto &C : CGSCCOptimizerLateEPCallbacks)
+ C(MainCGPipeline, Level);
+
// Lastly, add the core function simplification pipeline nested inside the
// CGSCC walk.
MainCGPipeline.addPass(createCGSCCToFunctionPassAdaptor(
buildFunctionSimplificationPipeline(Level, Phase)));
- for (auto &C : CGSCCOptimizerLateEPCallbacks)
- C(MainCGPipeline, Level);
-
return MIWP;
}
@@ -1800,6 +1800,13 @@
MPM.addPass(
createModuleToFunctionPassAdaptor(LowerMatrixIntrinsicsPass(true)));
+ if (!CGSCCOptimizerLateEPCallbacks.empty()) {
+ CGSCCPassManager CGPM(DebugLogging);
+ for (auto &C : CGSCCOptimizerLateEPCallbacks)
+ C(CGPM, Level);
+ if (!CGPM.isEmpty())
+ MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
+ }
if (!LateLoopOptimizationsEPCallbacks.empty()) {
LoopPassManager LPM(DebugLogging);
for (auto &C : LateLoopOptimizationsEPCallbacks)
@@ -1825,13 +1832,6 @@
if (!FPM.isEmpty())
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
}
- if (!CGSCCOptimizerLateEPCallbacks.empty()) {
- CGSCCPassManager CGPM(DebugLogging);
- for (auto &C : CGSCCOptimizerLateEPCallbacks)
- C(CGPM, Level);
- if (!CGPM.isEmpty())
- MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
- }
if (!VectorizerStartEPCallbacks.empty()) {
FunctionPassManager FPM(DebugLogging);
for (auto &C : VectorizerStartEPCallbacks)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93871.313887.patch
Type: text/x-patch
Size: 2763 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201228/ebbf29d9/attachment.bin>
More information about the llvm-commits
mailing list