-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Allow MIR debuginfo to point to a variable's address #111440
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @jackh726 (rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
7394a57
to
29ff2bc
Compare
r? mir-opt |
r=me with the debuginfo test extended to have a case where |
☔ The latest upstream changes (presumably #111493) made this pull request unmergeable. Please resolve the merge conflicts. |
29ff2bc
to
8fb888d
Compare
That's perfect, thanks! @bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (bc88895): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 661.349s -> 660.613s (-0.11%) |
MIR optimizations currently do not to operate on borrowed locals.
When enabling #106285, many borrows will be left as-is because they are used in debuginfo. This pass allows to replace this pattern directly in MIR debuginfo:
becomes
This pass is implemented as a drive-by in ReferencePropagation MIR pass.
This transformation allows following following MIR opts to treat _2 as an unborrowed local, and optimize it as such, even in builds with debuginfo.
In codegen, when encountering
a => &..&_2
, we create a list of allocas:Caveat: this transformation looses the exact type, we do not differentiate
a
as a immutable, mutable reference or a raw pointer. Everything is declared to*mut
to codegen. I'm not convinced this is a blocker.