-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Limit storage duration of inlined always live locals #79027
Conversation
6569ec7
to
832d02d
Compare
// FIXME: MIR optimization that run at mir-opt-level >= 2 might remove storage makers for | ||
// some locals. This breaks compatibility with state transform that runs after inlining. | ||
// As a workaround, we give such locals a storage for the duration of the call. | ||
insert_storage_markers: tcx.sess.opts.debugging_opts.mir_opt_level >= 2, |
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.
So the real fix would be to make sure we do not lose storage markers? Are you sure it's lost storage markers and not simply "never added" ones? I was sure we have lots of locals without storage markers.
Or maybe we should just go for full #68622 anyway...
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.
So the real fix would be to make sure we do not lose storage markers?
This is what I had in mind originally, but we can also consider it to be a valid transformation even if it is suboptimal.
I was sure we have lots of locals without storage markers.
Locals marked as internal do not participate in validation performed by the state transform. Though, In that context I think it makes sense to always limit storage of those locals simply to help stack space optimizations.
maybe we should just go for full #68622 anyway...
It is unclear to me how the end of storage could be determined, especially for any local whose address escapes at some point.
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.
It is unclear to me how the end of storage could be determined, especially for any local whose address escapes at some point.
Ah, we'd still have a "StorageDead" of sorts: InvalidateBorrows
. It's not quite the same thing, but it will allow us to figure out that if we manually computed a StorageDead
, it could not be before an InvalidateBorrows
of the same local.
832d02d
to
e7b6b61
Compare
@bors r+ |
📌 Commit e7b6b61 has been approved by |
Blocked on #78966 (tests need to be updated after it lands). |
e7b6b61
to
f27d56d
Compare
Updated tests. This is now unblocked. |
@bors r+ |
📌 Commit f27d56d has been approved by |
…r=oli-obk Limit storage duration of inlined always live locals Closes rust-lang#76375.
Rollup of 9 pull requests Successful merges: - rust-lang#77939 (Ensure that the source code display is working with DOS backline) - rust-lang#78138 (Upgrade dlmalloc to version 0.2) - rust-lang#78967 (Make codegen tests compatible with extra inlining) - rust-lang#79027 (Limit storage duration of inlined always live locals) - rust-lang#79077 (document that __rust_alloc is also magic to our LLVM fork) - rust-lang#79088 (clarify `span_label` documentation) - rust-lang#79097 (Code block invalid html tag lint) - rust-lang#79105 (std: Fix test `symlink_hard_link` on Windows) - rust-lang#79107 (build-manifest: strip newline from rustc version) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Closes #76375.