"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gen/optimizer.cpp" between
ldc-1.32.1.tar.gz and ldc-1.32.2.tar.gz

About: LDC is a LLVM-based D compiler.

optimizer.cpp  (ldc-1.32.1):optimizer.cpp  (ldc-1.32.2)
skipping to change at line 620 skipping to change at line 620
} }
/** /**
* Adds a set of optimization passes to the given module/function pass * Adds a set of optimization passes to the given module/function pass
* managers based on the given optimization and size reduction levels. * managers based on the given optimization and size reduction levels.
* *
* The selection mirrors Clang behavior and is based on LLVM's * The selection mirrors Clang behavior and is based on LLVM's
* PassManagerBuilder. * PassManagerBuilder.
*/ */
//Run optimization passes using the new pass manager //Run optimization passes using the new pass manager
void runOptimizationPasses(llvm::Module *M) { void runOptimizationPasses(llvm::Module *M) {
TimeTraceScope timeScope("Optimization passes");
// Create a ModulePassManager to hold and optimize the collection of // Create a ModulePassManager to hold and optimize the collection of
// per-module passes we are about to build. // per-module passes we are about to build.
unsigned optLevelVal = optLevel(); unsigned optLevelVal = optLevel();
unsigned sizeLevelVal = sizeLevel(); unsigned sizeLevelVal = sizeLevel();
// builder.OptLevel = optLevel; // builder.OptLevel = optLevel;
// builder.SizeLevel = sizeLevel; // builder.SizeLevel = sizeLevel;
// builder.PrepareForLTO = opts::isUsingLTO(); // builder.PrepareForLTO = opts::isUsingLTO();
// builder.PrepareForThinLTO = opts::isUsingThinLTO(); // builder.PrepareForThinLTO = opts::isUsingThinLTO();
skipping to change at line 660 skipping to change at line 662
si.registerCallbacks(pic, &fam); si.registerCallbacks(pic, &fam);
PassBuilder pb(gTargetMachine, getPipelineTuningOptions(optLevelVal, sizeLevel Val), PassBuilder pb(gTargetMachine, getPipelineTuningOptions(optLevelVal, sizeLevel Val),
getPGOOptions(), &pic); getPGOOptions(), &pic);
ModulePassManager mpm; ModulePassManager mpm;
if (!noVerify) { if (!noVerify) {
pb.registerPipelineStartEPCallback([&](ModulePassManager &mpm, pb.registerPipelineStartEPCallback([&](ModulePassManager &mpm,
OptimizationLevel level) { OptimizationLevel level) {
mpm.addPass(createModuleToFunctionPassAdaptor(VerifierPass())); mpm.addPass(VerifierPass());
}); });
} }
pb.registerPipelineStartEPCallback([&](ModulePassManager &mpm, pb.registerPipelineStartEPCallback([&](ModulePassManager &mpm,
OptimizationLevel level) { OptimizationLevel level) {
addPGOPasses(mpm, level); addPGOPasses(mpm, level);
}); });
if (opts::isSanitizerEnabled(opts::AddressSanitizer)) { if (opts::isSanitizerEnabled(opts::AddressSanitizer)) {
pb.registerOptimizerLastEPCallback([&](ModulePassManager &mpm, pb.registerOptimizerLastEPCallback([&](ModulePassManager &mpm,
skipping to change at line 750 skipping to change at line 752
} else if (opts::isUsingLTO()) { } else if (opts::isUsingLTO()) {
mpm = pb.buildLTOPreLinkDefaultPipeline(level); mpm = pb.buildLTOPreLinkDefaultPipeline(level);
} else { } else {
mpm = pb.buildPerModuleDefaultPipeline(level); mpm = pb.buildPerModuleDefaultPipeline(level);
} }
mpm.run(*M,mam); mpm.run(*M,mam);
} }
//Run codgen passes using the legacy pass manager //Run codgen passes using the legacy pass manager
void runCodegenPasses(llvm::Module* M) { void runCodegenPasses(llvm::Module* M) {
TimeTraceScope timeScope("Codegen passes");
legacy::PassManager mpm; legacy::PassManager mpm;
// Add an appropriate TargetLibraryInfo pass for the module's triple. // Add an appropriate TargetLibraryInfo pass for the module's triple.
TargetLibraryInfoImpl *tlii = TargetLibraryInfoImpl *tlii =
new TargetLibraryInfoImpl(Triple(M->getTargetTriple())); new TargetLibraryInfoImpl(Triple(M->getTargetTriple()));
// The -disable-simplify-libcalls flag actually disables all builtin optzns. // The -disable-simplify-libcalls flag actually disables all builtin optzns.
if (disableSimplifyLibCalls) if (disableSimplifyLibCalls)
tlii->disableAllFunctions(); tlii->disableAllFunctions();
 End of changes. 3 change blocks. 
1 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)