MPM.addPass(InstrProfiling(*Options, false));
});
- if (CodeGenOpts.OptimizationLevel == 0) {
- MPM = PB.buildO0DefaultPipeline(Level, IsLTO || IsThinLTO);
- } else if (IsThinLTO) {
+ if (IsThinLTO) {
MPM = PB.buildThinLTOPreLinkDefaultPipeline(Level);
} else if (IsLTO) {
MPM = PB.buildLTOPreLinkDefaultPipeline(Level);
PB.registerLoopAnalyses(LAM);
PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
- ModulePassManager MPM;
- if (OL == OptimizationLevel::O0)
- MPM = PB.buildO0DefaultPipeline(OL);
- else
- MPM = PB.buildPerModuleDefaultPipeline(OL);
+ ModulePassManager MPM = PB.buildPerModuleDefaultPipeline(OL);
MPM.addPass(PrintModulePass(OS));
MPM.run(M, MAM);
// Create the pass manager.
llvm::ModulePassManager mpm;
- if (opts.OptimizationLevel == 0)
- mpm = pb.buildO0DefaultPipeline(level, opts.PrepareForFullLTO ||
- opts.PrepareForThinLTO);
- else if (opts.PrepareForFullLTO)
+ if (opts.PrepareForFullLTO)
mpm = pb.buildLTOPreLinkDefaultPipeline(level);
else if (opts.PrepareForThinLTO)
mpm = pb.buildThinLTOPreLinkDefaultPipeline(level);
/// optimization and code generation. It is particularly tuned to fit well
/// when IR coming into the LTO phase was first run through \c
/// addPreLinkLTODefaultPipeline, and the two coordinate closely.
- ///
- /// Note that \p Level cannot be `O0` here. The pipelines produced are
- /// only intended for use when attempting to optimize code. If frontends
- /// require some transformations for semantic reasons, they should explicitly
- /// build them.
ModulePassManager
buildThinLTODefaultPipeline(OptimizationLevel Level,
const ModuleSummaryIndex *ImportSummary);
/// run. It works to minimize the IR which needs to be analyzed without
/// making irreversible decisions which could be made better during the LTO
/// run.
- ///
- /// Note that \p Level cannot be `O0` here. The pipelines produced are
- /// only intended for use when attempting to optimize code. If frontends
- /// require some transformations for semantic reasons, they should explicitly
- /// build them.
ModulePassManager buildLTOPreLinkDefaultPipeline(OptimizationLevel Level);
/// Build an LTO default optimization pipeline to a pass manager.
/// optimization and code generation. It is particularly tuned to fit well
/// when IR coming into the LTO phase was first run through \c
/// addPreLinkLTODefaultPipeline, and the two coordinate closely.
- ///
- /// Note that \p Level cannot be `O0` here. The pipelines produced are
- /// only intended for use when attempting to optimize code. If frontends
- /// require some transformations for semantic reasons, they should explicitly
- /// build them.
ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level,
ModuleSummaryIndex *ExportSummary);
.Case("O3", OptimizationLevel::O3)
.Case("Os", OptimizationLevel::Os)
.Case("Oz", OptimizationLevel::Oz);
- if (L == OptimizationLevel::O0 && Matches[1] != "thinlto" &&
- Matches[1] != "lto") {
- MPM.addPass(buildO0DefaultPipeline(L, Matches[1] == "thinlto-pre-link" ||
- Matches[1] == "lto-pre-link"));
- return Error::success();
- }
// This is consistent with old pass manager invoked via opt, but
// inconsistent with clang. Clang doesn't enable loop vectorization
ModulePassManager
PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level,
bool LTOPreLink) {
- assert(Level != OptimizationLevel::O0 &&
- "Must request optimizations for the default pipeline!");
+ if (Level == OptimizationLevel::O0)
+ return buildO0DefaultPipeline(Level, LTOPreLink);
ModulePassManager MPM;
ModulePassManager
PassBuilder::buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level) {
- assert(Level != OptimizationLevel::O0 &&
- "Must request optimizations for the default pipeline!");
+ if (Level == OptimizationLevel::O0)
+ return buildO0DefaultPipeline(Level, /*LTOPreLink*/true);
ModulePassManager MPM;
ModulePassManager
PassBuilder::buildLTOPreLinkDefaultPipeline(OptimizationLevel Level) {
- assert(Level != OptimizationLevel::O0 &&
- "Must request optimizations for the default pipeline!");
// FIXME: We should use a customized pre-link pipeline!
return buildPerModuleDefaultPipeline(Level,
/* LTOPreLink */ true);
pb.crossRegisterProxies(lam, fam, cgam, mam);
ModulePassManager mpm;
- if (*ol == OptimizationLevel::O0)
- mpm.addPass(pb.buildO0DefaultPipeline(*ol));
- else
- mpm.addPass(pb.buildPerModuleDefaultPipeline(*ol));
-
+ mpm.addPass(pb.buildPerModuleDefaultPipeline(*ol));
mpm.run(*m, mam);
return Error::success();
};
PB.registerLoopAnalyses(LAM);
PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
- if (OptLevel)
- MPM.addPass(PB.buildPerModuleDefaultPipeline(getOptLevel(OptLevel)));
- else
- MPM.addPass(PB.buildO0DefaultPipeline(getOptLevel(OptLevel)));
-
+ MPM.addPass(PB.buildPerModuleDefaultPipeline(getOptLevel(OptLevel)));
MPM.run(M, MAM);
}