-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Compile hangs endlessly in LLVM in await-heavy code when ThinLTO is enabled #66036
Comments
10f12fe...b3a0350 is the range and the following is the list of bors commits in that range: b3a0350 Auto merge of #65982 - RalfJung:miri, r=alexcrichton |
I had to double check to be sure, but the first bad commit was 060b6cb, "Update hashbrown to 0.6.2" The only reason I can come up with for this is that the change in hashbrown caused some IR to be emitted in a different order, and this triggered a bug somewhere, possibly LLVM, but before invoking the linker. |
I finally have a reproducer that works with
(I've also used the |
Reduced: reduced.zip |
For future reference, here's how I got the above reproducer. Note that this is for a hang, but could easily be adapted for crashing as well. PrereqsI had already minimized the rust source code manually, which allowed me to identify the exact function that was causing the hang. It turned out that pulling out a self-contained example was really difficult or impossible; this bug seemed to depend on a certain set of things being in a given codegen unit, for example. If I had some code that depended on items Foo, Bar, Baz, then pulled those dependencies and the offending function into their own file, the problem suddenly went away. I had already run Getting a llvm reproducerThe Debugging LLVM page of the rustc guide was very helpful here. Note that the following steps are easier if you can set
[1]: Disabling debuginfo doesn't quite work, since you're probably depending on libraries (like libstd) that were compiled with debuginfo, and their code has been inlined into yours at this point. Minimizing the reproducerCongratulations! You now have a reproducer, but it may be huge. I used both For minimizing hangs, what you want to do is use
#!/bin/bash -x
timeout 4 /code/fuchsia-rust/rust/build/x86_64-unknown-linux-gnu/llvm/bin/opt -instcombine "$@" -o opt-out
if [ $? -eq 124 ]; then
echo "TIMED OUT"
exit 1
elif [ $? -eq 0 ]; then
echo "SUCCESS"
exit 0
else
echo "INVALID"
exit 0
fi The bugpoint run took around 9 hours in my case. llvm-reduce was much shorter, since the case was already minimized. One final annoyance is that these two tools expect inverted exit codes from your interesting-ness script (I had to swap |
@petrhosek filed an issue upstream: https://bugs.llvm.org/show_bug.cgi?id=44245 |
Patch has landed: https://reviews.llvm.org/D71164 |
…sform-fixes, r=alexcrichton Update LLVM Fixes #67855 (rust-lang/llvm-project#31) Fixes #66036 (rust-lang/llvm-project#32) r? @nikic @alexcrichton
Some code went from compiling in <10 seconds to (hours) in between commits 10f12fe..b3a0350 (unfortunately I don't have a smaller range right now).
The regression only happens when ThinLTO is enabled. Full LTO doesn't have the slowdown.
Here's the source code which is causing the regression. The function has about 20
.await
points, which I suspect might be related. It doesn't seem to have anything to do with inlining the awaited function (I replaced it with a panic and linking was still slow).Here's the LLVM IR for the fast and slow cases (built with the above commits of rustc, respectively): llvm-ir.zipEDIT: See below for a reproducer
cc @petrhosek
The text was updated successfully, but these errors were encountered: