[all-commits] [llvm/llvm-project] 00b9fb: [SPIRV] Add a `SPIRVTypeInst` type with some guard...
Juan Manuel Martinez Caamaño via All-commits
all-commits at lists.llvm.org
Tue Feb 10 10:44:55 PST 2026
Branch: refs/heads/users/jmmartinez/spirv/guardrails
Home: https://github.com/llvm/llvm-project
Commit: 00b9fbfc05541471d2124e0f9da6a0451de36dcd
https://github.com/llvm/llvm-project/commit/00b9fbfc05541471d2124e0f9da6a0451de36dcd
Author: Juan Manuel Martinez Caamaño <jmartinezcaamao at gmail.com>
Date: 2026-02-10 (Tue, 10 Feb 2026)
Changed paths:
M llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h
Log Message:
-----------
[SPIRV] Add a `SPIRVTypeInst` type with some guardrails
Currently `SPIRVType` is an alias of `MachineInstr`:
```cpp
using SPIRVType = const MachineInstr;
```
Consider the function below from the backend:
```cpp
inline Register getTypeReg(MachineRegisterInfo *MRI, Register OpReg) {
SPIRVType *TypeInst = MRI->getVRegDef(OpReg);
return TypeInst && TypeInst->getOpcode() ==
SPIRV::OpFunctionParameter
? TypeInst->getOperand(1).getReg()
: OpReg;
}
```
How can `TypeInst` be an `OpFunctionParameter` which returns a value?
In all our tests `OpReg` is a value register. Why do we return the type
operand for `OpFunctionParamter` and something else anything else?
This code doesn't make any sense.
To avoid continuing down this path, this patch proposes `SPIRVTypeInst`
which is a wrapper around `MachineInstr` with an extra `assert`.
The idea is to replace the use of `SPIRVType` little-by-little.
Commit: 2a733202e299a6dd82e507e2e44aef36143241d1
https://github.com/llvm/llvm-project/commit/2a733202e299a6dd82e507e2e44aef36143241d1
Author: Juan Manuel Martinez Caamaño <jmartinezcaamao at gmail.com>
Date: 2026-02-10 (Tue, 10 Feb 2026)
Changed paths:
M llvm/lib/Target/SPIRV/SPIRVISelLowering.cpp
Log Message:
-----------
[SPIRV][NFC] Replace `SPIRVType` with `SPIRVTypeInst`
Commit: 1be30ded317ece2ee4391f8c981da63fffe2c837
https://github.com/llvm/llvm-project/commit/1be30ded317ece2ee4391f8c981da63fffe2c837
Author: Juan Manuel Martinez Caamaño <jmartinezcaamao at gmail.com>
Date: 2026-02-10 (Tue, 10 Feb 2026)
Changed paths:
M llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h
Log Message:
-----------
[SPIRV] Finish SPIRVTypeInst implementation
Commit: 040b9adab5fd9a4ca50bc1073285f75faa15fb44
https://github.com/llvm/llvm-project/commit/040b9adab5fd9a4ca50bc1073285f75faa15fb44
Author: Juan Manuel Martinez Caamaño <jmartinezcaamao at gmail.com>
Date: 2026-02-10 (Tue, 10 Feb 2026)
Changed paths:
M llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h
Log Message:
-----------
[SPIRV][NFC] Add deprecation comment
Compare: https://github.com/llvm/llvm-project/compare/1051d384b893...040b9adab5fd
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list