Skip to content

Commit 8cc82ee

Browse files
committed
Auto merge of #77793 - tmiasko:no-op-discriminant, r=ecstatic-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.
2 parents bc74dd7 + ecd7862 commit 8cc82ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_mir/src/transform/remove_noop_landing_pads.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl RemoveNoopLandingPads {
4343
// These are all nops in a landing pad
4444
}
4545

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

0 commit comments

Comments
 (0)