Consider CopyForDeref
for DestProp.
This commit is contained in:
parent
8f7e441a54
commit
982726cdc4
1 changed files with 3 additions and 2 deletions
|
@ -328,7 +328,8 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Merger<'a, 'tcx> {
|
||||||
match &statement.kind {
|
match &statement.kind {
|
||||||
StatementKind::Assign(box (dest, rvalue)) => {
|
StatementKind::Assign(box (dest, rvalue)) => {
|
||||||
match rvalue {
|
match rvalue {
|
||||||
Rvalue::Use(Operand::Copy(place) | Operand::Move(place)) => {
|
Rvalue::CopyForDeref(place)
|
||||||
|
| Rvalue::Use(Operand::Copy(place) | Operand::Move(place)) => {
|
||||||
// These might've been turned into self-assignments by the replacement
|
// These might've been turned into self-assignments by the replacement
|
||||||
// (this includes the original statement we wanted to eliminate).
|
// (this includes the original statement we wanted to eliminate).
|
||||||
if dest == place {
|
if dest == place {
|
||||||
|
@ -754,7 +755,7 @@ impl<'tcx> Visitor<'tcx> for FindAssignments<'_, '_, 'tcx> {
|
||||||
fn visit_statement(&mut self, statement: &Statement<'tcx>, _: Location) {
|
fn visit_statement(&mut self, statement: &Statement<'tcx>, _: Location) {
|
||||||
if let StatementKind::Assign(box (
|
if let StatementKind::Assign(box (
|
||||||
lhs,
|
lhs,
|
||||||
Rvalue::Use(Operand::Copy(rhs) | Operand::Move(rhs)),
|
Rvalue::CopyForDeref(rhs) | Rvalue::Use(Operand::Copy(rhs) | Operand::Move(rhs)),
|
||||||
)) = &statement.kind
|
)) = &statement.kind
|
||||||
{
|
{
|
||||||
let Some((src, dest)) = places_to_candidate_pair(*lhs, *rhs, self.body) else {
|
let Some((src, dest)) = places_to_candidate_pair(*lhs, *rhs, self.body) else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue