-
Notifications
You must be signed in to change notification settings - Fork 13k
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
When LLVM's location discriminator value limit is exceeded, emit locations with dummy spans instead of dropping them entirely #135643
Conversation
Some changes occurred in compiler/rustc_codegen_gcc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. One thing -- is it possible to conjure a regression test for this? I imagine that it's not going to be very feasible because the test case would have to exceed "LLVM's location discriminator value limit", but I wanted to ask in case you actually have a magical way. Based on the synthetic reproducer linked in #135332, we might be able to synthetic generate such a test case in a run-make test. What do you think?
EDIT: no that might be fragile, because it would be testing against an LLVM-internal limit which I'm not sure is guaranteed to remain the same between different LLVM versions.
I would consider this for a beta backport + stable backport because a real-world crate (as reported in #135332) is impacted when trying to generate debuginfo for some configuration such as debug = "line-tables-only" # any value that's not "none"
lto = "fat" This PR changes locations to use dummy spans instead of being dropped entirely to inhibit generation of broken LLVM modules which fail to contain The stable backport nomination is because 1.84.0 still "unconditionally verif[ies] the LLVM IR in the backend (twice), ignoring the value of the verify-llvm-ir option". That was changed in #133499 which would be available for 1.85.0. @rustbot label +beta-nominated +stable-nominated |
I attempted to turn the reporter-provided testcase into a compile test but could not get it to fail. We have existing tests that exceed LLVM's limits (it's currently only 4096, so not hard to exceed). But the provided testcase also requires fat pgo and some other ingredient not present in compiletest that I failed to isolate ... |
I'll see if I can cook up a test that fails locally. If not, the change is mostly "obvious" enough. |
I was able to conjure a regression test based on the reproducer. It's not pretty, but notably it fails without the changes in this PR with the broken LLVM module error, and passes with the changes in this PR. Running the test locally on msvc to double check. |
Ok, the regression test fails as expected on both linux and msvc without the fix in this PR. @khuey could you cherry-pick jieyouxu@1439412, and check that if we have three commits:
That the regression test fails at (1.) against master, but passes after (3.) for you locally as well? I could also just push the commit to your branch if you prefer. Feel free to improve the test where suitable. |
This PR modifies cc @jieyouxu |
Thanks. This test does fail after commits 1 and 2 but passes after 3. I trimmed the compiler flags a bit. Assuming you're fine with the 30 second runtime (fat lto + verify-llvm-ir = ouch) it looks good to me. |
Yeah I noticed the test being slow which is not great. If we ever think this is too long versus the value that the test provides, then I wouldn't mind deleting this test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, two minor nits on the test, otherwise LGTM
tests/run-make/llvm-location-discriminator-limit-dummy-span/rmake.rs
Outdated
Show resolved
Hide resolved
tests/run-make/llvm-location-discriminator-limit-dummy-span/rmake.rs
Outdated
Show resolved
Hide resolved
Let me know what you think of those comment changes. If that's satisfactory I'll either squash those into the test commit or squash all the commits together, your choice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me. Let's just squash the commits.
…tions with dummy spans instead of dropping them entirely Revert most of rust-lang#133194 (except the test and the comment fixes). Then refix not emitting locations at all when the correct location discriminator value exceeds LLVM's capacity.
r=me after PR CI is green @bors delegate+ rollup=never |
@bors p=5 (rollup scheduling) |
☀️ Test successful - checks-actions |
Finished benchmarking commit (6a64e3b): 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 2.5%, secondary 2.8%)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.
CyclesResults (secondary 2.6%)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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 767.44s -> 766.257s (-0.15%) |
Beta backport accepted as per compiler team on Zulip. A backport PR will be authored by the release team at the end of the current development cycle. Backport labels handled by them. Stable backport approved as well. Leaning to motivate for a dot release. @rustbot label +beta-accepted +stable-accepted |
[beta] backports - Always force non-trimming of path in `unreachable_patterns` lint rust-lang#135310 - Add Profile Override for Non-Git Sources rust-lang#135433 - resolve symlinks of LLVM tool binaries before copying them rust-lang#135585 - add cache to `AmbiguityCausesVisitor` rust-lang#135618 - When LLVM's location discriminator value limit is exceeded, emit locations with dummy spans instead of dropping them entirely rust-lang#135643 - Temporarily bring back `Rvalue::Len` rust-lang#135709 - make it possible to use ci-rustc on tarball sources rust-lang#135722 - Remove test panic from File::open rust-lang#135837 - Only assert the `Parser` size on specific arches rust-lang#135855 r? cuviper
[beta] backports - Always force non-trimming of path in `unreachable_patterns` lint rust-lang#135310 - Add Profile Override for Non-Git Sources rust-lang#135433 - resolve symlinks of LLVM tool binaries before copying them rust-lang#135585 - add cache to `AmbiguityCausesVisitor` rust-lang#135618 - When LLVM's location discriminator value limit is exceeded, emit locations with dummy spans instead of dropping them entirely rust-lang#135643 - Temporarily bring back `Rvalue::Len` rust-lang#135709 - make it possible to use ci-rustc on tarball sources rust-lang#135722 - Remove test panic from File::open rust-lang#135837 - Only assert the `Parser` size on specific arches rust-lang#135855 - [beta] TRPL: more backward-compatible Edition changes rust-lang#135843 r? cuviper
[beta] backports - Always force non-trimming of path in `unreachable_patterns` lint rust-lang#135310 - Add Profile Override for Non-Git Sources rust-lang#135433 - resolve symlinks of LLVM tool binaries before copying them rust-lang#135585 - add cache to `AmbiguityCausesVisitor` rust-lang#135618 - When LLVM's location discriminator value limit is exceeded, emit locations with dummy spans instead of dropping them entirely rust-lang#135643 - make it possible to use ci-rustc on tarball sources rust-lang#135722 - Remove test panic from File::open rust-lang#135837 - Only assert the `Parser` size on specific arches rust-lang#135855 - [beta] TRPL: more backward-compatible Edition changes rust-lang#135843 r? cuviper
[stable] Prepare Rust 1.84.1 point release - [Fix ICE 132920 in duplicate-crate diagnostics.](rust-lang#133304) - [Fix errors for overlapping impls in incremental rebuilds.](rust-lang#133828) - [Fix slow compilation related to the next-generation trait solver.](rust-lang#135618) - [Fix debuginfo when LLVM's location discriminator value limit is exceeded.](rust-lang#135643) - Fixes for building Rust from source: - [Only try to distribute `llvm-objcopy` if llvm tools are enabled.](rust-lang#134240) - [Add Profile Override for Non-Git Sources.](rust-lang#135433) - [Resolve symlinks of LLVM tool binaries before copying them.](rust-lang#135585) - [Make it possible to use ci-rustc on tarball sources.](rust-lang#135722) cc `@rust-lang/release` r? ghost
Dropping them fails
-Zverify-llvm-ir
.Fixes #135332.
r? @jieyouxu