[llvm] [SPIRV] Add a `SPIRVTypeInst` type with some guardrails (PR #179947)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 5 06:48:31 PST 2026


================
@@ -140,6 +143,9 @@ SPIRVTargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
 
 inline Register getTypeReg(MachineRegisterInfo *MRI, Register OpReg) {
   SPIRVType *TypeInst = MRI->getVRegDef(OpReg);
+  assert(!SPIRVTypeInst::definesATypeRegister(TypeInst) &&
+         "The TypeInst is never a type, because this function doesn't make any "
+         "sense");
----------------
Keenuts wrote:

I don't get it, a TypeInst is never a type, but the assert in the SPIRVTypeInst requires it to be a type?

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


More information about the llvm-commits mailing list