[PATCH] D118611: [PassBuilder] Add OpenMPOpt to default LTO pipeline
Joseph Huber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 31 07:46:19 PST 2022
jhuber6 created this revision.
jhuber6 added a reviewer: jdoerfert.
Herald added subscribers: ormris, steven_wu, guansong, hiraditya, inglorion, yaxunl.
jhuber6 requested review of this revision.
Herald added subscribers: llvm-commits, sstefan1.
Herald added a project: LLVM.
The LTO support for OpenMP offloading allows us to run the OpenMPOpt
pass during the LTO pipeline. This patch introduces an early run of the
Module pass and a late run of the CGSCC pass. These are quick no-ops if
there is no OpenMP in the module.
Depends on D118198 <https://reviews.llvm.org/D118198>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118611
Files:
llvm/lib/Passes/PassBuilderPipelines.cpp
llvm/test/Other/new-pm-lto-defaults.ll
Index: llvm/test/Other/new-pm-lto-defaults.ll
===================================================================
--- llvm/test/Other/new-pm-lto-defaults.ll
+++ llvm/test/Other/new-pm-lto-defaults.ll
@@ -27,6 +27,7 @@
; CHECK-O: Running pass: Annotation2Metadata
; CHECK-O-NEXT: Running pass: CrossDSOCFIPass
+; CHECK-O-NEXT: Running pass: OpenMPOptPass
; CHECK-O-NEXT: Running pass: GlobalDCEPass
; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass
; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
@@ -87,6 +88,7 @@
; CHECK-O23SZ-NEXT: Running analysis: GlobalsAA on [module]
; CHECK-O23SZ-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}AAManager
; CHECK-O23SZ-NEXT: Invalidating analysis: AAManager on foo
+; CHECK-O23SZ-NEXT: Running pass: OpenMPOptCGSCCPass on (foo)
; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass on foo
; CHECK-O23SZ-NEXT: Running analysis: LoopAnalysis on foo
; CHECK-O23SZ-NEXT: Running pass: LCSSAPass on foo
Index: llvm/lib/Passes/PassBuilderPipelines.cpp
===================================================================
--- llvm/lib/Passes/PassBuilderPipelines.cpp
+++ llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1454,6 +1454,9 @@
MPM.addPass(RequireAnalysisPass<ProfileSummaryAnalysis, Module>());
}
+ // Try to run OpenMP optimizations, quick no-op if no OpenMP metadata present.
+ MPM.addPass(OpenMPOptPass());
+
// Remove unused virtual tables to improve the quality of code generated by
// whole-program devirtualization and bitset lowering.
MPM.addPass(GlobalDCEPass());
@@ -1648,6 +1651,10 @@
addVectorPasses(Level, MainFPM, /* IsFullLTO */ true);
+ // Run the OpenMPOpt CGSCC pass again late.
+ MPM.addPass(
+ createModuleToPostOrderCGSCCPassAdaptor(OpenMPOptCGSCCPass()));
+
invokePeepholeEPCallbacks(MainFPM, Level);
MainFPM.addPass(JumpThreadingPass(/*InsertFreezeWhenUnfoldingSelect*/ true));
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(MainFPM),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118611.404530.patch
Type: text/x-patch
Size: 1970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220131/1a635410/attachment.bin>
More information about the llvm-commits
mailing list