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());
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),
; 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
; 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