@@ -48,7 +48,7 @@ fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
48
48
}
49
49
}
50
50
51
- let any_replacement = ssa . copy_classes ( ) . iter_enumerated ( ) . any ( | ( l , & h ) | l != h ) ;
51
+ let any_replacement = !storage_to_remove . is_empty ( ) || !const_locals . is_empty ( ) ;
52
52
53
53
Replacer {
54
54
tcx,
@@ -79,9 +79,7 @@ fn fully_moved_locals(ssa: &SsaLocals, body: &Body<'_>) -> BitSet<Local> {
79
79
let mut fully_moved = BitSet :: new_filled ( body. local_decls . len ( ) ) ;
80
80
81
81
for ( _, rvalue, _) in ssa. assignments ( body) {
82
- let ( Rvalue :: Use ( Operand :: Copy ( place) | Operand :: Move ( place) )
83
- | Rvalue :: CopyForDeref ( place) ) = rvalue
84
- else {
82
+ let ( Rvalue :: Use ( Operand :: Copy ( place) ) | Rvalue :: CopyForDeref ( place) ) = rvalue else {
85
83
continue ;
86
84
} ;
87
85
@@ -173,11 +171,9 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> {
173
171
}
174
172
175
173
fn visit_operand ( & mut self , operand : & mut Operand < ' tcx > , loc : Location ) {
176
- if let Operand :: Move ( place) = * operand
174
+ if let Operand :: Move ( place) = * operand {
177
175
// A move out of a projection of a copy is equivalent to a copy of the original projection.
178
- && !place. is_indirect_first_projection ( )
179
- {
180
- if !self . fully_moved . contains ( place. local ) {
176
+ if !place. is_indirect_first_projection ( ) && !self . fully_moved . contains ( place. local ) {
181
177
* operand = Operand :: Copy ( place) ;
182
178
} else if let Some ( local) = place. as_local ( )
183
179
&& let Some ( val) = self . const_locals . get ( & local)
0 commit comments