-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Backend code generator crash while running pass "X86 DAG->DAG Instruction Selection". Maybe related to coroutines. #104525
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
Comments
@llvm/issue-subscribers-backend-x86 Author: atul (atulkatti)
We are seeing this crash in official builds of Edge. This repro has been provided using internal LLVM build that should be compatible with the following Chromium upstream LLVM build:
CLANG_REVISION = 'llvmorg-20-init-1009-g7088a5ed'
CLANG_SUB_REVISION = 9
This actively blocks our consumption of the latest LLVM bits, so it will help if this gets looked at soon. We had the exact same break during Chromium clang roll in May-2024 and it got fixed with the next Clang roll in June-2024. It is broken again with the latest August-2024 Clang roll referenced above. We are wondering if this is related to churn in the coroutines codebase. Attaching the reduced repro source file if this can be included in your test suite so it can prevent future breaks in this area. The crash reproduces with the LLC command line. Bugpoint crashed during reduction. Please find both the reduced repro source file and the .bc file (attached as .bc.txt). $src\out\official_x64>$src\third_party\llvm-build\Release+Asserts\bin\llc.exe coroutines_main.bc
Exception Code: 0xC000001D |
Can you check if this was fixed in e027e04? |
|
I don't think llvm.coro.alloc is supposed to reach the backend. The CoroCleanup pass should remove it in the middle end. |
There's a commit that mention CoroCleanup from the end of July
@atulkatti are you using ThinLTO? |
@topperc Yes, we are using ThinLTO. But on the reduced repro I was able to reproduce the issue even when LTO was disabled. |
@topperc Correction, my earlier attempt to disable ThinLTO didn't work as expected due to flags being added elsewhere in the build system. Once I disabled ThinLTO correctly the crash went away. However, we can't disable ThinLTO completely in our product build. Would it be possible to make a fix for this issue when ThinLTO is being used? |
@apolloww Can you take a look at this? |
The change moves both
|
@apolloww The repro file I shared is from a reduced repro of the real issue we are facing in Edge official build where ThinLTO is enabled. The crashing code exists in a first party library that we consume and we can't disable ThinLTO due to performance implications in important scenarios. Can a fix be made so that the intrinsics get lowered before codegen when ThinLTO is enabled? |
Could you share the flags that are passed into pre-link compilation and linking? If every step is invoked via clang driver, the intrinsics should be lowered before entering the CodeGen pipeline. So if you have something like
It should work. |
@apolloww Thanks for looking into this and providing guidance. After looking into our build logs I was able to confirm that we are indeed disabling ThinLTO during linking. So there is a mismatch in the ThinLTO enablement between the compilation and linking steps. We will try to workaround this issue by enabling ThinLTO for the failing component. |
I can reproduce this crash as well, and revert #100205 helps. |
Is this still causing asan pipeline failure? |
No asan failures, it's not on bot. This is a different issue, internal build with CFI and ThinLTO.
|
OK. I'll put the change behind a flag. |
Flags is LGTM. However, I didn't look into details, but are there difficulties to support invocation like in the stack trace? |
From the stack trace, it seems the invocation was through regular LTO compilation. I think Coro passes are not enabled in regular LTO post-link pipeline. Even if we fix this case, there are still cases that user can take the pre-link compilation output and feed directly into codegen pipeline. #107153 puts the change behind a flag. |
There is llvm-project/lld/ELF/Driver.cpp:2994:3 in the stack And according to llvm-project/lld/ELF/Driver.cpp Line 2999 in 111b062
it can be used by ThinLTO |
During LTO indexing in lld Should we add Coro* passes in buildLTODefaultPipeline? |
ThinLTO delays handling of coroutines to ThinLTO backend. However it's usually possible to use ThinLTO prelink objects for FullLTO. In this case we have left-over coroutines which crash in codegen. Issue #104525.
ThinLTO delays handling of coroutines to ThinLTO backend. However it's usually possible to use ThinLTO prelink objects for FullLTO. In this case we have left-over coroutines which crash in codegen. Issue llvm#104525.
ThinLTO delays handling of coroutines to ThinLTO backend. However it's usually possible to use ThinLTO prelink objects for FullLTO. In this case we have left-over coroutines which crash in codegen. Issue llvm#104525.
ThinLTO delays handling of coroutines to ThinLTO backend. However it's usually possible to use ThinLTO prelink objects for FullLTO. In this case we have left-over coroutines which crash in codegen. Issue llvm#104525.
Possibly fixed by #134434? |
We are seeing this crash in official builds of Edge. This repro has been provided using internal LLVM build that should be compatible with the following Chromium upstream LLVM build:
CLANG_REVISION = 'llvmorg-20-init-1009-g7088a5ed'
CLANG_SUB_REVISION = 9
This actively blocks our consumption of the latest LLVM bits, so it will help if this gets looked at soon. We had the exact same break during Chromium clang roll in May-2024 and it got fixed with the next Clang roll in June-2024. It is broken again with the latest August-2024 Clang roll referenced above. We are wondering if this is related to churn in the coroutines codebase. Attaching the reduced repro source file if this can be included in your test suite so it can prevent future breaks in this area.
The crash reproduces with the LLC command line. Bugpoint crashed during reduction.
llc.exe coroutines_main.bc
Please find both the reduced repro source file and the .bc file (attached as .bc.txt).
coroutines_main.bc.txt
Reduce repro source file main.cc.txt
The text was updated successfully, but these errors were encountered: