Skip to content

Commit ce2e3e0

Browse files
committed
Do not visit rvalues twice.
1 parent 87104ba commit ce2e3e0

File tree

1 file changed

+2
-1
lines changed
  • compiler/rustc_mir_transform/src

1 file changed

+2
-1
lines changed

compiler/rustc_mir_transform/src/gvn.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,6 @@ impl<'tcx> MutVisitor<'tcx> for VnState<'_, 'tcx> {
741741
}
742742

743743
fn visit_statement(&mut self, stmt: &mut Statement<'tcx>, location: Location) {
744-
self.super_statement(stmt, location);
745744
if let StatementKind::Assign(box (_, ref mut rvalue)) = stmt.kind
746745
// Do not try to simplify a constant, it's already in canonical shape.
747746
&& !matches!(rvalue, Rvalue::Use(Operand::Constant(_)))
@@ -755,6 +754,8 @@ impl<'tcx> MutVisitor<'tcx> for VnState<'_, 'tcx> {
755754
*rvalue = Rvalue::Use(Operand::Copy(local.into()));
756755
self.reused_locals.insert(local);
757756
}
757+
} else {
758+
self.super_statement(stmt, location);
758759
}
759760
}
760761
}

0 commit comments

Comments
 (0)