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

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 6 07:53:01 PST 2026


jmmartinez wrote:

> > `SPIRVType` is `using SPIRVType = const MachineInstr;`.
> 
> > The replacement may not be always exact (e.g. I haven't added the support for `DenseMap` so it cannot be used as a key). And changing all the uses of `SPIRVType` in one shot is a pretty big. And that is assuming that the assertion does not detect any problem.
> > We have to do it gradually.
> 
> This PR changes here are mostly replacing `SPIRVType` directly with `SPIRVTypeInst`. Would it work to add the DenseMap support and then replace the `using SPIRVType = const MachineInstr` with `using SPIRVType = SPIRVTypeInst`?

It doesn't work directly because we use `SPIRVType` often as pointer.

> > `SPIRVType` is `using SPIRVType = const MachineInstr;`.
> 
> > The replacement may not be always exact (e.g. I haven't added the support for `DenseMap` so it cannot be used as a key). And changing all the uses of `SPIRVType` in one shot is a pretty big. And that is assuming that the assertion does not detect any problem.
> > We have to do it gradually.
> 
> This PR changes here are mostly replacing `SPIRVType` directly with `SPIRVTypeInst`. Would it work to add the DenseMap support and then replace the `using SPIRVType = const MachineInstr` with `using SPIRVType = SPIRVTypeInst`?

`using SPIRVType = SPIRVTypeInst` this one doesn't work since `SPIRVType` is often used as a pointer.

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


More information about the llvm-commits mailing list