]> git.lizzy.rs Git - rust.git/commitdiff
Enable const prop into operands at mir_opt_level=2
authorDániel Buga <bugadani@gmail.com>
Wed, 23 Sep 2020 13:54:21 +0000 (15:54 +0200)
committerDániel Buga <bugadani@gmail.com>
Wed, 23 Sep 2020 17:03:10 +0000 (19:03 +0200)
compiler/rustc_mir/src/transform/const_prop.rs

index aa88719c26a4936d386e55a03400d8555fb334af..0f04ead94dd33e480f0ce0c59e10e84e99850f17 100644 (file)
@@ -1046,9 +1046,9 @@ fn visit_body(&mut self, body: &mut Body<'tcx>) {
     fn visit_operand(&mut self, operand: &mut Operand<'tcx>, location: Location) {
         self.super_operand(operand, location);
 
-        // Only const prop copies and moves on `mir_opt_level=3` as doing so
-        // currently increases compile time.
-        if self.tcx.sess.opts.debugging_opts.mir_opt_level >= 3 {
+        // Only const prop copies and moves on `mir_opt_level=2` as doing so
+        // currently slightly increases compile time in some cases.
+        if self.tcx.sess.opts.debugging_opts.mir_opt_level >= 2 {
             self.propagate_operand(operand)
         }
     }
@@ -1246,8 +1246,8 @@ fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
             | TerminatorKind::InlineAsm { .. } => {}
             // Every argument in our function calls have already been propagated in `visit_operand`.
             //
-            // NOTE: because LLVM codegen gives performance regressions with it, so this is gated
-            // on `mir_opt_level=3`.
+            // NOTE: because LLVM codegen gives slight performance regressions with it, so this is
+            // gated on `mir_opt_level=2`.
             TerminatorKind::Call { .. } => {}
         }