-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Elide superfluous storage markers #99946
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
Changes from all commits
943a380
162bd16
625af2c
c2b74f9
f8ca6aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -616,7 +616,9 @@ impl<'tcx> Inliner<'tcx> { | |
// If there are any locals without storage markers, give them storage only for the | ||
// duration of the call. | ||
for local in callee_body.vars_and_temps_iter() { | ||
if integrator.always_live_locals.contains(local) { | ||
if !callee_body.local_decls[local].internal | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @rust-lang/wg-const-eval I think we could do something similar for internal locals without storage markers in const eval. Basically not eagerly initialize them and also not error when writing to them without marking them as live first. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds like you are suggesting a change to the operational semantics of MIR? I don't quite understand what change you are suggesting, though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somewhat. We'd need to change MIR validation to make sure that internal locals are only referenced after being assigned to first. If that is guaranteed, then it's just an evaluator optimization to lazily initialize internal locals There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'd also have to make sure that syntactically they are never accessed after the StorageDead, and that they never have their address taken. Otherwise we could miss UB. |
||
&& integrator.always_live_locals.contains(local) | ||
{ | ||
let new_local = integrator.map_local(local); | ||
caller_body[callsite.block].statements.push(Statement { | ||
source_info: callsite.source_info, | ||
|
@@ -629,7 +631,9 @@ impl<'tcx> Inliner<'tcx> { | |
// the slice once. | ||
let mut n = 0; | ||
for local in callee_body.vars_and_temps_iter().rev() { | ||
if integrator.always_live_locals.contains(local) { | ||
if !callee_body.local_decls[local].internal | ||
&& integrator.always_live_locals.contains(local) | ||
{ | ||
let new_local = integrator.map_local(local); | ||
caller_body[block].statements.push(Statement { | ||
source_info: callsite.source_info, | ||
|
Uh oh!
There was an error while loading. Please reload this page.