[llvm] [SPIRV] Emit NonSemantic DebugValue (PR #224158)

Manuel Carrasco via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 04:19:57 PDT 2026


================
@@ -515,6 +642,18 @@ MCRegister SPIRVNonSemanticDebugHandler::emitOpConstantI32(
   if (!Inserted)
     return It->second;
 
+  for (const MachineInstr *MI : MAI.getMSInstrs(SPIRV::MB_TypeConstVars)) {
+    if (MI->getOpcode() != SPIRV::OpConstantI || MI->getNumOperands() < 3 ||
+        !MI->getOperand(2).isImm())
+      continue;
+    if (MAI.getRegisterAlias(MI->getMF(), MI->getOperand(1).getReg()) !=
+            I32TypeReg ||
+        static_cast<uint64_t>(MI->getOperand(2).getImm()) != Value)
+      continue;
+    It->second = MAI.getRegisterAlias(MI->getMF(), MI->getOperand(0).getReg());
+    return It->second;
+  }
----------------
mgcarrasco wrote:

Maybe? 
```
if (MCRegister Found =
        findModuleConstant(SPIRV::OpConstantI, I32TypeReg, Value,
                           /*IsBool=*/false, /*IsWide=*/false, MAI)) {
  It->second = Found;
  return Found;
}
```

https://github.com/llvm/llvm-project/pull/224158


More information about the llvm-commits mailing list