Uh oh!
There was an error while loading. Please reload this page.
Add discriminators to DILocations when multiple functions are inlined into a single point. - #132613
Conversation
rustbot
commented
Nov 4, 2024
r? @chenyukang rustbot has assigned @chenyukang. Use |
This comment has been minimized.
This comment has been minimized.
workingjubilee
commented
Nov 5, 2024
@bors try |
bors
commented
Nov 5, 2024
Add discriminators to DILocations when multiple functions are inlined into a single point. LLVM does not expect to ever see multiple dbg_declares for the same variable at the same location with different values. proc-macros make it possible for arbitrary code, including multiple calls that get inlined, to happen at any given location in the source code. Add discriminators when that happens so these locations are different to LLVM. This may interfere with the AddDiscriminators pass in LLVM, which is added by the unstable flag -Zdebug-info-for-profiling. Fixesrust-lang#131944
bors
commented
Nov 5, 2024
☀️ Try build successful - checks-actions |
jieyouxu
commented
Nov 5, 2024
@bors try |
bors
commented
Nov 5, 2024
Add discriminators to DILocations when multiple functions are inlined into a single point. LLVM does not expect to ever see multiple dbg_declares for the same variable at the same location with different values. proc-macros make it possible for arbitrary code, including multiple calls that get inlined, to happen at any given location in the source code. Add discriminators when that happens so these locations are different to LLVM. This may interfere with the AddDiscriminators pass in LLVM, which is added by the unstable flag -Zdebug-info-for-profiling. Fixesrust-lang#131944 try-job: x86_64-msvc try-job: i686-msvc
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
bors
commented
Nov 5, 2024
💔 Test failed - checks-actions |
jieyouxu
commented
Nov 5, 2024
(I edited the PR description to include a few "selected" try-jobs which should bring about reasonable target variance, rest is probably full build) |
workingjubilee
commented
Nov 7, 2024
@bors try |
bors
commented
Nov 7, 2024
Add discriminators to DILocations when multiple functions are inlined into a single point. LLVM does not expect to ever see multiple dbg_declares for the same variable at the same location with different values. proc-macros make it possible for arbitrary code, including multiple calls that get inlined, to happen at any given location in the source code. Add discriminators when that happens so these locations are different to LLVM. This may interfere with the AddDiscriminators pass in LLVM, which is added by the unstable flag -Zdebug-info-for-profiling. Fixesrust-lang#131944 try-job: x86_64-msvc try-job: i686-msvc try-job: x86_64-mingw try-job: aarch64-apple try-job: test-various try-job: dist-various-1 try-job: armhf-gnu
This comment has been minimized.
This comment has been minimized.
bors
commented
Nov 7, 2024
💔 Test failed - checks-actions |
Uh oh!
There was an error while loading. Please reload this page.
jieyouxu
commented
Nov 7, 2024
@bors try |
bors
commented
Nov 7, 2024
Add discriminators to DILocations when multiple functions are inlined into a single point. LLVM does not expect to ever see multiple dbg_declares for the same variable at the same location with different values. proc-macros make it possible for arbitrary code, including multiple calls that get inlined, to happen at any given location in the source code. Add discriminators when that happens so these locations are different to LLVM. This may interfere with the AddDiscriminators pass in LLVM, which is added by the unstable flag -Zdebug-info-for-profiling. Fixesrust-lang#131944 try-job: x86_64-msvc try-job: i686-msvc try-job: x86_64-mingw try-job: aarch64-apple try-job: test-various try-job: dist-various-1 try-job: armhf-gnu
This comment has been minimized.
This comment has been minimized.
bors
commented
Nov 7, 2024
💔 Test failed - checks-actions |
cuviper
commented
Nov 9, 2024
workingjubilee
commented
Nov 9, 2024
@bors rollup=never |
bors
commented
Nov 9, 2024
☔ The latest upstream changes (presumably #132584) made this pull request unmergeable. Please resolve the merge conflicts. |
jieyouxu
commented
Nov 9, 2024
Unfortunately needs a rebase, r=me after that. @bors delegate |
jieyouxu
commented
Nov 9, 2024
Er maybe @bors delegate+ |
bors
commented
Nov 9, 2024
… into a single point. LLVM does not expect to ever see multiple dbg_declares for the same variable at the same location with different values. proc-macros make it possible for arbitrary code, including multiple calls that get inlined, to happen at any given location in the source code. Add discriminators when that happens so these locations are different to LLVM. This may interfere with the AddDiscriminators pass in LLVM, which is added by the unstable flag -Zdebug-info-for-profiling. Fixesrust-lang#131944
jieyouxu
commented
Nov 9, 2024
@bors r+ rollup=never p=1 (fixes a P-critical, but also make it easier to bisect) |
bors
commented
Nov 9, 2024
bors
commented
Nov 9, 2024
bors
commented
Nov 9, 2024
☀️ Test successful - checks-actions |
rust-timer
commented
Nov 9, 2024
Finished benchmarking commit (b026d85): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -1.7%, secondary -3.2%)This 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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeResults (primary 0.0%)This 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: 781.253s -> 780.559s (-0.09%) |
Add discriminators to DILocations when multiple functions are inlined into a single point. LLVM does not expect to ever see multiple dbg_declares for the same variable at the same location with different values. proc-macros make it possible for arbitrary code, including multiple calls that get inlined, to happen at any given location in the source code. Add discriminators when that happens so these locations are different to LLVM. This may interfere with the AddDiscriminators pass in LLVM, which is added by the unstable flag -Zdebug-info-for-profiling.
apiraino
commented
Nov 14, 2024
Beta backport visited during triage meeting on Zulip. We're not completely clear about the value added by backporting this. Is this regression really critical? Also the patch fixing this is a bit suspect of causing another ICE (#132900). So let's postpone the backport decision for a week (release in 2 weeks from now) waiting to have more info. |
Drop debug info instead of panicking if we exceed LLVM's capability to represent it Recapping a bit of history here: In rust-lang#128861 I made debug info correctly represent parameters to inline functions by removing a fake lexical block that had been inserted to suppress LLVM assertions and by deduplicating those parameters. LLVM, however, expects to see a single parameter _with distinct locations_, particularly distinct inlinedAt values on the DILocations. This generally worked because no matter how deep the chain of inlines it takes two different call sites in the original function to result in the same function being present multiple times, and a function call requires a non-zero number of characters, but macros threw a wrench in that in rust-lang#131944. At the time I thought the issue there was limited to proc-macros, where an arbitrary amount of code can be generated at a single point in the source text. In rust-lang#132613 I added discriminators to DILocations that would otherwise be the same to repair rust-lang#131944[^1]. This works, but LLVM's capacity for discriminators is not infinite (LLVM actually only allocates 12 bits for this internally). At the time I thought it would be very rare for anyone to hit the limit, but rust-lang#132900 proved me wrong. In the relatively-minimized test case it also became clear to me that the issue affects regular macros too, because the call to the inlined function will (without collapse_debuginfo on the macro) be attributed to the (repeated, if the macro is used more than once) textual callsite in the macro definition. This PR fixes the panic by dropping debug info when we exceed LLVM's maximum discriminator value. There's also a preceding commit for a related but distinct issue: macros that use collapse_debuginfo should in fact have their inlinedAts collapsed to the macro callsite and thus not need discriminators at all (and not panic/warn accordingly when the discriminator limit is exhausted). Fixesrust-lang#132900 r? `@jieyouxu` [^1]: Editor's note: `fix` is a magic keyword in PR description that apparently will close the linked issue (it's closed already in this case, but still).
LLVM does not expect to ever see multiple dbg_declares for the same variable at the same location with different values. proc-macros make it possible for arbitrary code, including multiple calls that get inlined, to happen at any given location in the source code. Add discriminators when that happens so these locations are different to LLVM.
This may interfere with the AddDiscriminators pass in LLVM, which is added by the unstable flag -Zdebug-info-for-profiling.
Fixes#131944