-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move promotion into its own pass #65949
Conversation
48eafee
to
89f0507
Compare
This comment has been minimized.
This comment has been minimized.
89f0507
to
e635488
Compare
This comment has been minimized.
This comment has been minimized.
7967fbe
to
d7536b2
Compare
Is popping bubble wrap needless work 😁? I can do some of it if you want. |
I actually laughed out loud at this. Sorry, my post reads as a bit petulant to me today. The last time I did a major change to I didn't want to waste time removing stuff that you didn't really want removed, so if you tell me you want all dead code (including the full checklist) gone I can do that. Alternatively, if it really is like popping bubble wrap for you, have at it. |
Just remembered I saw somewhere someone point out that beta branches on November 5th. I'd suggest we remove the old promotion logic from |
Agreed. This would be ideal. |
f483911
to
1fd12cf
Compare
☔ The latest upstream changes (presumably #65728) made this pull request unmergeable. Please resolve the merge conflicts. |
1fd12cf
to
d856a4f
Compare
d856a4f
to
e1abd02
Compare
`remove_storage_dead_and_drop` has been copied to `promote_temps` and now operates on an array of `Candidate`s instead of a bitset.
We bailed out of `QualifyAndPromoteConsts` immediately if the `min_const_fn` checks failed, which sometimes resulted in additional, spurious errors since promotion was skipped. We now do promotion in a completely separate pass, so this is no longer an issue.
We don't do promotion here anymore, so `Checker` will never even visit the body of a non-const `fn`.
e1abd02
to
a3b0369
Compare
| ^-- | ||
| || | ||
| |temporary value created here | ||
| returns a reference to data owned by the current function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was this bug, looks confusing, maybe related to min_const_fn
checks? cc @oli-obk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, there's a commit that explains this!
@bors r+ |
📌 Commit a3b0369 has been approved by |
…=eddyb Move promotion into its own pass **edited** This adds a `PromoteTemps` pass, which runs after the old `QualifyAndPromoteConsts` pass, that *only* does promotion (no const-checking). Everything related to promotion has been removed from `QualifyAndPromoteConstants`: it no longer even visits the body of a non-const `fn`. As a result we no longer need to keep the `BitSet` of promotable locals that was returned by `mir_const_qualif`. Rvalue-static promotion in a `const` is now done in `promote_consts`, and it operates on a set of `Candidate`s instead. This will allow me–in a later PR–to create promoted MIR fragments for `const`s when necessary, which could resolve some shortcomings of the current approach (removing `StorageDead`). r? @eddyb
Rollup of 6 pull requests Successful merges: - #65949 (Move promotion into its own pass) - #65994 (Point at where clauses where the associated item was restricted) - #66050 (Fix C aggregate-passing ABI on powerpc) - #66134 (Point at formatting descriptor string when it is invalid) - #66172 (Stabilize @file command line arguments) - #66226 (add link to unstable book for asm! macro) Failed merges: r? @ghost
edited
This adds a
PromoteTemps
pass, which runs after the oldQualifyAndPromoteConsts
pass, that only does promotion (no const-checking). Everything related to promotion has been removed fromQualifyAndPromoteConstants
: it no longer even visits the body of a non-constfn
.As a result we no longer need to keep the
BitSet
of promotable locals that was returned bymir_const_qualif
. Rvalue-static promotion in aconst
is now done inpromote_consts
, and it operates on a set ofCandidate
s instead. This will allow me–in a later PR–to create promoted MIR fragments forconst
s when necessary, which could resolve some shortcomings of the current approach (removingStorageDead
).r? @eddyb