-
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
[MIR-opt] conflicting debug info for argument #67586
Comments
I wonder if this is caused by MIR inlining or by other passes like copy propagation. Anyway, we can improve this for now by treating anything not in the outermost |
Minimal repro, with pub fn foo(bar: usize) -> usize {
std::convert::identity(bar)
} |
…ne-arg, r=nagisa rustc_codegen_ssa: don't treat inlined variables as debuginfo arguments. Fixes rust-lang#67586 by limiting `ArgumentVariable` special-casing to `VarDebugInfo` entries that are in `OUTERMOST_SOURCE_SCOPE`, i.e. the function's own argument scope. That excludes `VarDebugInfo` from inlined callees, which can also point to the caller's argument locals. This is a snippet from the optimized MIR (including inlining) of the testcase: ```rust fn foo(_1: usize) -> usize { debug bar => _1; // in scope 0 at ./example.rs:2:12: 2:15 let mut _0: usize; // return place in scope 0 at ./example.rs:2:27: 2:32 scope 1 { debug x => _1; // in scope 1 at /rustc/9ed29b6ff6aa2e048b09c27af8f62ee3040bdb37/src/libcore/convert/mod.rs:106:26: 106:27 } ``` `scope 1` is from inlining the `identity` call, and `debug x => _1;` comes from the body of `core::convert::identity`, so they are now ignored for the purposes of determining the `ArgumentVariable` debuginfo associated to `_1`.
…agisa rustc_codegen_ssa: don't treat inlined variables as debuginfo arguments. Fixes #67586 by limiting `ArgumentVariable` special-casing to `VarDebugInfo` entries that are in `OUTERMOST_SOURCE_SCOPE`, i.e. the function's own argument scope. That excludes `VarDebugInfo` from inlined callees, which can also point to the caller's argument locals. This is a snippet from the optimized MIR (including inlining) of the testcase: ```rust fn foo(_1: usize) -> usize { debug bar => _1; // in scope 0 at ./example.rs:2:12: 2:15 let mut _0: usize; // return place in scope 0 at ./example.rs:2:27: 2:32 scope 1 { debug x => _1; // in scope 1 at /rustc/9ed29b6ff6aa2e048b09c27af8f62ee3040bdb37/src/libcore/convert/mod.rs:106:26: 106:27 } ``` `scope 1` is from inlining the `identity` call, and `debug x => _1;` comes from the body of `core::convert::identity`, so they are now ignored for the purposes of determining the `ArgumentVariable` debuginfo associated to `_1`.
@rustbot modify labels: +A-mir +C-bug +requires-nightly
The text was updated successfully, but these errors were encountered: