Skip to content

Commit

Permalink
Activate NewPM support
Browse files Browse the repository at this point in the history
Co-authored-by: Valentin Churavy <v.churavy@gmail.com>
  • Loading branch information
pchintalapudi and vchuravy committed May 10, 2023
1 parent 190f841 commit 9e3da19
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9169,7 +9169,9 @@ extern "C" JL_DLLEXPORT void jl_init_codegen_impl(void)
extern "C" JL_DLLEXPORT void jl_teardown_codegen_impl() JL_NOTSAFEPOINT
{
// output LLVM timings and statistics
jl_ExecutionEngine->printTimers();
// Guard against exits before we have initialized the ExecutionEngine
if (jl_ExecutionEngine)
jl_ExecutionEngine->printTimers();
PrintStatistics();
}

Expand Down
6 changes: 2 additions & 4 deletions src/jitlayers.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,8 @@ struct OptimizationOptions {
};

// LLVM's new pass manager is scheduled to replace the legacy pass manager
// for middle-end IR optimizations. However, we have not qualified the new
// pass manager on our optimization pipeline yet, so this remains an optional
// define
#if defined(HAS_SANITIZER) && JL_LLVM_VERSION >= 150000
// for middle-end IR optimizations.
#if JL_LLVM_VERSION >= 150000
#define JL_USE_NEW_PM
#endif

Expand Down
7 changes: 4 additions & 3 deletions src/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ static void buildFullPipeline(ModulePassManager &MPM, PassBuilder *PB, Optimizat
{
FunctionPassManager FPM;
FPM.addPass(SROAPass());
FPM.addPass(InstSimplifyPass());
// SROA can duplicate PHI nodes which can block LowerSIMD
FPM.addPass(InstCombinePass());
FPM.addPass(JumpThreadingPass());
FPM.addPass(CorrelatedValuePropagationPass());
FPM.addPass(ReassociatePass());
Expand All @@ -384,7 +385,7 @@ static void buildFullPipeline(ModulePassManager &MPM, PassBuilder *PB, Optimizat
#endif
LPM2.addPass(LICMPass(LICMOptions()));
JULIA_PASS(LPM2.addPass(JuliaLICMPass()));
LPM2.addPass(SimpleLoopUnswitchPass(true, true));
LPM2.addPass(SimpleLoopUnswitchPass(false, true));
LPM2.addPass(LICMPass(LICMOptions()));
JULIA_PASS(LPM2.addPass(JuliaLICMPass()));
//LICM needs MemorySSA now, so we must use it
Expand All @@ -397,11 +398,11 @@ static void buildFullPipeline(ModulePassManager &MPM, PassBuilder *PB, Optimizat
LPM.addPass(LoopIdiomRecognizePass());
LPM.addPass(IndVarSimplifyPass());
LPM.addPass(LoopDeletionPass());
LPM.addPass(LoopFullUnrollPass());
invokeLoopOptimizerEndCallbacks(LPM, PB, O);
//We don't know if the loop end callbacks support MSSA
FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM), /*UseMemorySSA = */false));
}
FPM.addPass(LoopUnrollPass(LoopUnrollOptions().setRuntime(false)));
JULIA_PASS(FPM.addPass(AllocOptPass()));
FPM.addPass(SROAPass());
FPM.addPass(InstSimplifyPass());
Expand Down

0 comments on commit 9e3da19

Please sign in to comment.