Skip to content

Commit 61a9ab8

Browse files
committed
slightly adapt const prop
1 parent d257bac commit 61a9ab8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/librustc_mir/transform/const_prop.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
582582
Some(())
583583
}
584584

585-
fn propagate_operand(&mut self, operand: &mut Operand<'tcx>, location: Location) {
585+
fn propagate_operand(&mut self, operand: &mut Operand<'tcx>) {
586586
match *operand {
587587
Operand::Copy(l) | Operand::Move(l) => {
588588
if let Some(value) = self.get_const(l) {
@@ -606,7 +606,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
606606
}
607607
}
608608
}
609-
Operand::Constant(ref mut ct) => self.visit_constant(ct, location),
609+
Operand::Constant(_) => (),
610610
}
611611
}
612612

@@ -934,12 +934,12 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
934934
}
935935

936936
fn visit_operand(&mut self, operand: &mut Operand<'tcx>, location: Location) {
937+
self.super_operand(operand, location);
938+
937939
// Only const prop copies and moves on `mir_opt_level=3` as doing so
938940
// currently increases compile time.
939-
if self.tcx.sess.opts.debugging_opts.mir_opt_level < 3 {
940-
self.super_operand(operand, location)
941-
} else {
942-
self.propagate_operand(operand, location)
941+
if self.tcx.sess.opts.debugging_opts.mir_opt_level >= 3 {
942+
self.propagate_operand(operand)
943943
}
944944
}
945945

@@ -1114,7 +1114,7 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
11141114
// FIXME: This is currently redundant with `visit_operand`, but sadly
11151115
// always visiting operands currently causes a perf regression in LLVM codegen, so
11161116
// `visit_operand` currently only runs for propagates places for `mir_opt_level=3`.
1117-
self.propagate_operand(discr, location)
1117+
self.propagate_operand(discr)
11181118
}
11191119
// None of these have Operands to const-propagate.
11201120
TerminatorKind::Goto { .. }

0 commit comments

Comments
 (0)