@@ -59,22 +59,26 @@ impl<'tcx> crate::MirPass<'tcx> for CopyProp {
59
59
}
60
60
. visit_body_preserves_cfg ( body) ;
61
61
62
- if any_replacement {
63
- let move_data = MoveData :: gather_moves ( body, tcx, |_| true ) ;
62
+ debug ! ( ?head_storage_to_check) ;
64
63
65
- let maybe_uninit = MaybeUninitializedPlaces :: new ( tcx, body, & move_data)
66
- . iterate_to_fixpoint ( tcx, body, Some ( "mir_opt::copy_prop" ) )
67
- . into_results_cursor ( body) ;
64
+ if any_replacement {
65
+ // Debug builds have no use for the storage statements, so avoid extra work.
66
+ let storage_to_remove = if tcx. sess . emit_lifetime_markers ( ) {
67
+ let move_data = MoveData :: gather_moves ( body, tcx, |_| true ) ;
68
68
69
- debug ! ( ?head_storage_to_check) ;
69
+ let maybe_uninit = MaybeUninitializedPlaces :: new ( tcx, body, & move_data)
70
+ . iterate_to_fixpoint ( tcx, body, Some ( "mir_opt::copy_prop" ) )
71
+ . into_results_cursor ( body) ;
70
72
71
- let storage_to_remove = {
72
73
let mut storage_checker =
73
74
StorageChecker { maybe_uninit, head_storage_to_check, storage_to_remove } ;
74
75
75
76
storage_checker. visit_body ( body) ;
76
77
77
78
storage_checker. storage_to_remove
79
+ } else {
80
+ // Conservatively remove all storage statements for the head locals.
81
+ head_storage_to_check
78
82
} ;
79
83
StorageRemover { tcx, storage_to_remove } . visit_body_preserves_cfg ( body) ;
80
84
0 commit comments