[all-commits] [llvm/llvm-project] 541016: [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 04:10:36 PST 2026
Branch: refs/heads/users/jmmartinez/spirv/guardrails
Home: https://github.com/llvm/llvm-project
Commit: 541016c9e51ea743cd82f4baeb78410d21486351
https://github.com/llvm/llvm-project/commit/541016c9e51ea743cd82f4baeb78410d21486351
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: fa22d41c811a5bc71073e8f99987c77e963bd8c9
https://github.com/llvm/llvm-project/commit/fa22d41c811a5bc71073e8f99987c77e963bd8c9
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: 5682417691f1c3c298bd5c34d6163ae66f3801c9
https://github.com/llvm/llvm-project/commit/5682417691f1c3c298bd5c34d6163ae66f3801c9
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] Deprecate SPIRVType
Commit: a4df742f24fc62d7b0c443c8f33d42b577021768
https://github.com/llvm/llvm-project/commit/a4df742f24fc62d7b0c443c8f33d42b577021768
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
Compare: https://github.com/llvm/llvm-project/compare/39a0ab13dcf6...a4df742f24fc
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