Skip to content

rustc_codegen_ssa: don't treat inlined variables as debuginfo arguments. - #68802

Merged
bors merged 1 commit into
rust-lang:masterfrom
eddyb:debuginfo-there-can-only-be-one-arg
Feb 9, 2020
Merged

rustc_codegen_ssa: don't treat inlined variables as debuginfo arguments.#68802
bors merged 1 commit into
rust-lang:masterfrom
eddyb:debuginfo-there-can-only-be-one-arg

Conversation

@eddyb

@eddybeddyb commented Feb 3, 2020

Copy link
Copy Markdown
Contributor

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:

fnfoo(_1:usize) -> usize{
debug bar => _1;// in scope 0 at ./example.rs:2:12: 2:15letmut _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.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @varkor

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 3, 2020
@eddyb

eddyb commented Feb 3, 2020

Copy link
Copy Markdown
ContributorAuthor

r? @nagisa cc @bjorn3@nikomatsakis

@rust-highfiverust-highfive assigned nagisa and unassigned varkorFeb 3, 2020
@nagisa

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Feb 7, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 80515f7 has been approved by nagisa

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 7, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Feb 8, 2020
…ne-arg, r=nagisa
rustc_codegen_ssa: don't treat inlined variables as debuginfo arguments.
Fixesrust-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`.
@bors

bors commented Feb 8, 2020

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 80515f7 with merge 3df96f3...

bors added a commit that referenced this pull request Feb 8, 2020
…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`.
@bors

bors commented Feb 8, 2020

Copy link
Copy Markdown
Collaborator

💔 Test failed - checks-azure

@borsbors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 8, 2020
@eddyb

eddyb commented Feb 8, 2020

Copy link
Copy Markdown
ContributorAuthor

@bors retry

  • spurious(?) network error

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 8, 2020
@bors

bors commented Feb 8, 2020

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 80515f7 with merge a19edd6...

bors added a commit that referenced this pull request Feb 8, 2020
…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`.
@bors

bors commented Feb 9, 2020

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-azure
Approved by: nagisa
Pushing a19edd6 to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Feb 9, 2020
@bors
bors merged commit 80515f7 into rust-lang:masterFeb 9, 2020
@eddyb
eddyb deleted the debuginfo-there-can-only-be-one-arg branch February 9, 2020 00:58
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MIR-opt] conflicting debug info for argument

6 participants

@eddyb@rust-highfive@nagisa@bors@bjorn3@varkor