Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit f925a03

Browse files
committed
Make ConstPropagator only visit basic blocks when visiting body
Avoid exercising unevaluated constants and go straight to visit the blocks.
1 parent 0107cec commit f925a03

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustc_mir/transform/const_prop.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,12 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
833833
self.tcx
834834
}
835835

836+
fn visit_body(&mut self, body: &mut Body<'tcx>) {
837+
for (bb, data) in body.basic_blocks_mut().iter_enumerated_mut() {
838+
self.visit_basic_block_data(bb, data);
839+
}
840+
}
841+
836842
fn visit_constant(&mut self, constant: &mut Constant<'tcx>, location: Location) {
837843
trace!("visit_constant: {:?}", constant);
838844
self.super_constant(constant, location);

0 commit comments

Comments
 (0)