-
Notifications
You must be signed in to change notification settings - Fork 11k
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
[RemoveDIs] Load into new debug info format by default in llvm-link #86274
Conversation
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.
Seems sensible to do this for llvm-link
, thanks!
@@ -479,6 +480,9 @@ int main(int argc, char **argv) { | |||
|
|||
cl::HideUnrelatedOptions({&LinkCategory, &getColorCategory()}); | |||
cl::ParseCommandLineOptions(argc, argv, "llvm linker\n"); | |||
// Load bitcode into the new debug info format by default. |
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.
Ultra-nit: Maybe add a blank above this to separate it from the "default" parsing step.
…lvm-link step Set load-bitcode-into-experimental-debuginfo-iterators=false. Fixes flang compilation crash from llvm/llvm-project#86274.
…lvm-link step Set load-bitcode-into-experimental-debuginfo-iterators=false. Fixes flang compilation crash from llvm/llvm-project#86274.
Looks like this might cause assert failure for some scenarios. Simple reproducer on x86 Linux:
|
I think I see the issue, I think it's incidentally fixed by a PR that I have open - the rough outline is that the bitcode loading process for the new debug info format can hit this assertion if we lazy load, and change the debug info format of the module in between parsing the module and materializing its functions; in more detail:
A simple immediate fix for this would be to avoid catching
It's not an ideal solution, but it only needs to be temporary since a patch that fixes it is already ready. |
Thanks for the report and analysis.
Do you have a link to it?
We could also revert this till your patch lands if it fixes the issue. |
…at modules Fixes issue noted at: llvm#86274 When loading bitcode lazily, we may request debug intrinsics be upgraded to debug records during the module parsing phase; later on we perform this upgrade when materializing the module functions. If we change the module's debug info format between parsing and materializing however, then the requested upgrade is no longer correct and leads to an assertion. This patch fixes the issue by adding an extra check in the autoupgrader to see if the upgrade is no longer suitable, and either exit-out or fall back to the correct intrinsic->intrinsic upgrade if one is required. Adding this check in the autoupgrader is technically not optimal, since we could run the check a single time in a higher up call, but there's no way (that I can see) to do so without leaking through abstractions and making the bitcode/linking/materializing steps more complicated and brittle, and the check isn't particularly expensive.
My mistake, my existing patch doesn't fix the issue (the reproducer needed ToT clang as well as llvm-link), but the fix is straightforward enough - I've added one here, which has a slight overlap with my other review (which adds a new flag). @jsji does the linked patch fix all your crashes if applied? |
…at modules Fixes issue noted at: llvm/llvm-project#86274 When loading bitcode lazily, we may request debug intrinsics be upgraded to debug records during the module parsing phase; later on we perform this upgrade when materializing the module functions. If we change the module's debug info format between parsing and materializing however, then the requested upgrade is no longer correct and leads to an assertion. This patch fixes the issue by adding an extra check in the autoupgrader to see if the upgrade is no longer suitable, and either exit-out or fall back to the correct intrinsic->intrinsic upgrade if one is required. Adding this check in the autoupgrader is technically not optimal, since we could run the check a single time in a higher up call, but there's no way (that I can see) to do so without leaking through abstractions and making the bitcode/linking/materializing steps more complicated and brittle, and the check isn't particularly expensive.
Yes, looks like #87494 fixed the crashes. Thanks. |
…les (#87494) Fixes issue noted at: #86274 When loading bitcode lazily, we may request debug intrinsics be upgraded to debug records during the module parsing phase; later on we perform this upgrade when materializing the module functions. If we change the module's debug info format between parsing and materializing however, then the requested upgrade is no longer correct and leads to an assertion. This patch fixes the issue by adding an extra check in the autoupgrader to see if the upgrade is no longer suitable, and either exit-out or fall back to the correct intrinsic->intrinsic upgrade if one is required.
Directly load all bitcode into the new debug info format in llvm-link. This means that new-mode bitcode no longer round-trips back to old-mode after parsing, and that old-mode bitcode gets auto-upgraded to new-mode debug info (which is the current in-memory default in LLVM).