-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Which MIR passes should run on generator drop shims? #91576
Copy link
Copy link
Open
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-coroutinesArea: CoroutinesArea: CoroutinesC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-coroutinesArea: CoroutinesArea: CoroutinesC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Under normal circumstances, MIR shims have the following 5 passes applied:
AddMovesForPackedDropsRemoveNoopLandingPadsSimplifyCfg(a trivial cleanup pass)CriticalCallEdgesAbortUnwindingCallsHowever, generator drop shims are created by cloning the MIR for the original generator (?), which means they start out in
MirPhase::GeneratorLowering. Prior to #91475,run_passessilently returned without doing anything if theMirPhasewas greater than or equal to the expected one, so the aforementioned MIR passes were never executed. That behavior was only relevant when building drop shims, so #91475 added an explicit check to preserve it.Was this intentional? Notably
AddMovesForPackedDropsandAbortUnwindingCallshave soundness implications, andCriticalCallEdgesis needed to work around some codegen issues, so it seems like they should always run. However, they might not be applicable to generators specifically.Perhaps @tmandry knows the answer, or knows someone who does?