Rollup merge of #120688 - cjgillot:gvn-partial-move, r=oli-obk
GVN: also turn moves into copies with projections Fixes https://github.com/rust-lang/rust/issues/120613
This commit is contained in:
commit
65aa9eae73
4 changed files with 78 additions and 5 deletions
|
@ -1231,8 +1231,8 @@ impl<'tcx> MutVisitor<'tcx> for StorageRemover<'tcx> {
|
|||
|
||||
fn visit_operand(&mut self, operand: &mut Operand<'tcx>, _: Location) {
|
||||
if let Operand::Move(place) = *operand
|
||||
&& let Some(local) = place.as_local()
|
||||
&& self.reused_locals.contains(local)
|
||||
&& !place.is_indirect_first_projection()
|
||||
&& self.reused_locals.contains(place.local)
|
||||
{
|
||||
*operand = Operand::Copy(place);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue