[llvm] [SPIRV] Emit NonSemantic DebugValue (PR #224158)
Manuel Carrasco via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 17 04:13:30 PDT 2026
================
@@ -441,6 +558,16 @@ void SPIRVNonSemanticDebugHandler::prepareModuleOutput(
// fresh result ID for it now; the same ID is used in emitExtInst() operands.
if (!MAI.ExtInstSetMap.count(NSSet))
MAI.ExtInstSetMap[NSSet] = MAI.getNextIDRegister();
+
+ // Types, constants and globals never reach endInstruction(), and this section
+ // is written before every function body, so record them as already emitted.
+ // handleTypeDeclOrConstant() keeps only one instruction per signature here
+ // and aliases every duplicate to its id (which identifies them).
+ for (const MachineInstr *MI : MAI.getMSInstrs(SPIRV::MB_TypeConstVars)) {
+ MCRegister Id = getResultId(*MI, MAI);
+ if (Id.isValid())
+ ModuleScopeIds.insert(Id);
----------------
mgcarrasco wrote:
```
if (MCRegister Id = getResultId(*MI, MAI))
ModuleScopeIds.insert(Id);
```
https://github.com/llvm/llvm-project/pull/224158
More information about the llvm-commits
mailing list