From d7c66a8ec183fc16773ca66b6a308aeb2e9828e4 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 27 Mar 2018 12:22:02 -0700 Subject: [PATCH] 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. --- lib/cretonne/src/context.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cretonne/src/context.rs b/lib/cretonne/src/context.rs index 2441f19d02..5324248142 100644 --- a/lib/cretonne/src/context.rs +++ b/lib/cretonne/src/context.rs @@ -105,7 +105,9 @@ impl Context { } self.compute_domtree(); self.eliminate_unreachable_code(isa)?; - self.dce(isa)?; + if isa.flags().opt_level() != OptLevel::Fastest { + self.dce(isa)?; + } self.regalloc(isa)?; self.prologue_epilogue(isa)?; self.relax_branches(isa)