[llvm] [AsmPrinter] Do not emit label instructions after the function body if the target is SPIR-V (PR #107013)
Vyacheslav Levytskyy via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 3 22:18:23 PDT 2024
================
@@ -1960,7 +1960,9 @@ void AsmPrinter::emitFunctionBody() {
// are automatically sized.
bool EmitFunctionSize = MAI->hasDotTypeDotSizeDirective() && !TT.isWasm();
- if (EmitFunctionSize || needFuncLabels(*MF, *this)) {
+ // SPIR-V supports label instructions only inside a block, not after the
+ // function body.
+ if (!TT.isSPIRV() && (EmitFunctionSize || needFuncLabels(*MF, *this))) {
----------------
VyacheslavLevytskyy wrote:
Thank you @arsenm
Please see two lines above (line 1961) in this very general code a check for TT.isWasm(), showing similar approach as proposed in the PR.
As for needFuncLabels(), no, it has no overrides. It always returns true if valid debug info is present, and valid debug info is encoded by a private class member, thus forbidding any workarounds and on/off manipulations over valid debug info status (that actually also would be a worse hack that proposed in the PR).
Please see my comment to https://github.com/llvm/llvm-project/issues/102732 for more words about the problem, but the problem is pretty simple, there are no existing hooks/overrides that allow to keep SPIR-V valid due to this check for debug info in AsmPrinter.
https://github.com/llvm/llvm-project/pull/107013
More information about the llvm-commits
mailing list