diff options
| author | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-07-23 17:58:54 +0200 |
|---|---|---|
| committer | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-07-23 17:58:54 +0200 |
| commit | 61a9ab8fe64484458059d630ab3d0938f7f34ccf (patch) | |
| tree | 0e9db147f5f34bb48d5d5d65d9c95da565176129 /src | |
| parent | d257bacfea8a046c41d6841f897d17944f2f0e64 (diff) | |
slightly adapt const prop
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/transform/const_prop.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 2fa2167d5f8..024595466a2 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -582,7 +582,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { Some(()) } - fn propagate_operand(&mut self, operand: &mut Operand<'tcx>, location: Location) { + fn propagate_operand(&mut self, operand: &mut Operand<'tcx>) { match *operand { Operand::Copy(l) | Operand::Move(l) => { if let Some(value) = self.get_const(l) { @@ -606,7 +606,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { } } } - Operand::Constant(ref mut ct) => self.visit_constant(ct, location), + Operand::Constant(_) => (), } } @@ -934,12 +934,12 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, '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 { - self.super_operand(operand, location) - } else { - self.propagate_operand(operand, location) + if self.tcx.sess.opts.debugging_opts.mir_opt_level >= 3 { + self.propagate_operand(operand) } } @@ -1114,7 +1114,7 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> { // FIXME: This is currently redundant with `visit_operand`, but sadly // always visiting operands currently causes a perf regression in LLVM codegen, so // `visit_operand` currently only runs for propagates places for `mir_opt_level=3`. - self.propagate_operand(discr, location) + self.propagate_operand(discr) } // None of these have Operands to const-propagate. TerminatorKind::Goto { .. } |
