Skip to content

Commit 0dd0ba6

Browse files
committed
Fix sil-opt -opt-mode=none
Set the single-pass pipeline's isMandatory flag based on the opt-mode.
1 parent 547d87f commit 0dd0ba6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/sil-opt/SILOpt.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,13 @@ static llvm::cl::opt<std::string> EnableRequirementMachine(
465465

466466
static void runCommandLineSelectedPasses(SILModule *Module,
467467
irgen::IRGenModule *IRGenMod) {
468-
auto &opts = Module->getOptions();
468+
const SILOptions &opts = Module->getOptions();
469+
// If a specific pass was requested with -opt-mode=None, run the pass as a
470+
// mandatory pass.
471+
bool isMandatory = opts.OptMode == OptimizationMode::NoOptimization;
469472
executePassPipelinePlan(
470473
Module, SILPassPipelinePlan::getPassPipelineForKinds(opts, Passes),
471-
/*isMandatory*/ false, IRGenMod);
474+
isMandatory, IRGenMod);
472475

473476
if (Module->getOptions().VerifyAll)
474477
Module->verify();

0 commit comments

Comments
 (0)