-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[SPIR-V] Unexpected label emitted in SPIRVAsmPrinter when debug info is present #102732
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
@seven-mile Thank you for the report! I don't see any good workarounds using existing hooks/overrides.
A path that I see is that we fix it as a part of AsmPrinter.cpp itself by checking |
…f the target is SPIR-V (#107013) AsmPrinter always creates a symbol for the end of function if valid debug info is present. However, this breaks SPIR-V target's output, because SPIR-V specification allows label instructions only inside a block, not after the function body (see https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpLabel). This PR proposes to disable emission of label instructions after the function body if the target is SPIR-V. This PR is a fix of the #102732 issue.
Resolved by #107013 |
I used
-g
to emit debug info in Clang and get a LLVM IR module. When I tried to invokellc
and use SPIR-V backend to emit the final SPIR-V, an unexpected label is emitted afterOpFunctionEnd
:, which prevented the SPIR-V to be consumed by
spirv-as
. After disabling-g
, the label is gone. I believe it's caused by these lines in the base classAsmPrinter
:llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Lines 1945 to 1949 in 9a227ba
We need some overrides to disable this behaviour for SPIR-V.
The text was updated successfully, but these errors were encountered: