[all-commits] [llvm/llvm-project] 6d2f34: [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 03:26:07 PST 2026
Branch: refs/heads/users/jmmartinez/spirv/guardrails
Home: https://github.com/llvm/llvm-project
Commit: 6d2f34f520d6f4bc4cad800a71d7257ec6d1acfd
https://github.com/llvm/llvm-project/commit/6d2f34f520d6f4bc4cad800a71d7257ec6d1acfd
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: e81a8fe0278095bfcc250fc9ff1dd76535e69255
https://github.com/llvm/llvm-project/commit/e81a8fe0278095bfcc250fc9ff1dd76535e69255
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: 7d7b85c118fa7775934dcfaf91b5d3f356c90565
https://github.com/llvm/llvm-project/commit/7d7b85c118fa7775934dcfaf91b5d3f356c90565
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: 39a0ab13dcf626c9e6acbb181d1252a6ed35a595
https://github.com/llvm/llvm-project/commit/39a0ab13dcf626c9e6acbb181d1252a6ed35a595
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/57fcf5573ad4...39a0ab13dcf6
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