From a31518fbf4843e7c998131a97f4a35beb60dd625 Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 6 Oct 2021 20:37:24 +0200 Subject: [PATCH] opt-level >= 4 --- compiler/rustc_mir_transform/src/normalize_array_len.rs | 6 +++--- src/test/mir-opt/lower_array_len.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_mir_transform/src/normalize_array_len.rs b/compiler/rustc_mir_transform/src/normalize_array_len.rs index 7ed4cb402c7c..60e71130cd1d 100644 --- a/compiler/rustc_mir_transform/src/normalize_array_len.rs +++ b/compiler/rustc_mir_transform/src/normalize_array_len.rs @@ -15,9 +15,9 @@ pub struct NormalizeArrayLen; impl<'tcx> MirPass<'tcx> for NormalizeArrayLen { fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - // if tcx.sess.mir_opt_level() < 3 { - // return; - // } + if tcx.sess.mir_opt_level() < 4 { + return; + } // early returns for edge cases of highly unrolled functions if body.basic_blocks().len() > MAX_NUM_BLOCKS { diff --git a/src/test/mir-opt/lower_array_len.rs b/src/test/mir-opt/lower_array_len.rs index 994204058f60..fc12ee75fcfc 100644 --- a/src/test/mir-opt/lower_array_len.rs +++ b/src/test/mir-opt/lower_array_len.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z mir-opt-level=3 +// compile-flags: -Z mir-opt-level=4 // EMIT_MIR lower_array_len.array_bound.NormalizeArrayLen.diff // EMIT_MIR lower_array_len.array_bound.SimplifyLocals.diff