Skip to content

Commit

Permalink
Auto merge of rust-lang#77793 - tmiasko:no-op-discriminant, r=ecstati…
Browse files Browse the repository at this point in the history
…c-morse

Recognize discriminant reads as no-ops in RemoveNoopLandingPads

The cleanup blocks often contain read of discriminants. Teach
RemoveNoopLandingPads to recognize them as no-ops to remove
additional no-op landing pads.
  • Loading branch information
bors committed Oct 11, 2020
2 parents bc74dd7 + ecd7862 commit 8cc82ee
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl RemoveNoopLandingPads {
// These are all nops in a landing pad
}

StatementKind::Assign(box (place, Rvalue::Use(_))) => {
StatementKind::Assign(box (place, Rvalue::Use(_) | Rvalue::Discriminant(_))) => {
if place.as_local().is_some() {
// Writing to a local (e.g., a drop flag) does not
// turn a landing pad to a non-nop
Expand Down

0 comments on commit 8cc82ee

Please sign in to comment.