Don't run the DCE pass when optimization is disabled.

The main purpose of the DCE pass is to clean up dead code left behind by
the optimizer, so it's not valuable to run it when the optimizer isn't
being run.
This commit is contained in:
Dan Gohman
2018-03-27 12:22:02 -07:00
parent 72b7a4b3ef
commit d7c66a8ec1

View File

@@ -105,7 +105,9 @@ impl Context {
} }
self.compute_domtree(); self.compute_domtree();
self.eliminate_unreachable_code(isa)?; self.eliminate_unreachable_code(isa)?;
self.dce(isa)?; if isa.flags().opt_level() != OptLevel::Fastest {
self.dce(isa)?;
}
self.regalloc(isa)?; self.regalloc(isa)?;
self.prologue_epilogue(isa)?; self.prologue_epilogue(isa)?;
self.relax_branches(isa) self.relax_branches(isa)