mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
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.
This commit is contained in:
parent
0e022fc2b8
commit
ecd7862dfb
@ -43,7 +43,7 @@ impl RemoveNoopLandingPads {
|
|||||||
// These are all nops in a landing pad
|
// 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() {
|
if place.as_local().is_some() {
|
||||||
// Writing to a local (e.g., a drop flag) does not
|
// Writing to a local (e.g., a drop flag) does not
|
||||||
// turn a landing pad to a non-nop
|
// turn a landing pad to a non-nop
|
||||||
|
Loading…
Reference in New Issue
Block a user