[llvm] [SPIRV] Fix getNumScalarOrVectorTotalBitWidth to handle OpTypeBool type (PR #186296)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 13 09:24:57 PDT 2026
================
@@ -1442,8 +1428,9 @@ unsigned SPIRVGlobalRegistry::getNumScalarOrVectorTotalBitWidth(
Type = getSPIRVTypeForVReg(Type->getOperand(1).getReg());
}
return Type->getOpcode() == SPIRV::OpTypeInt ||
- Type->getOpcode() == SPIRV::OpTypeFloat
- ? NumElements * Type->getOperand(1).getImm()
+ Type->getOpcode() == SPIRV::OpTypeFloat ||
+ Type->getOpcode() == SPIRV::OpTypeBool
----------------
MrSidims wrote:
`OpTypeBool` in SPIR-V is not the same as `i1` from LLVM IR (so frankly, the fact that we are mapping them anyway is a bit speculative, but just works in most of the use cases). But since it has the following line in the definition:
`There is no physical size or bit pattern defined for these values.`
I feel uneasy to add it to `getNumScalarOrVectorTotalBitWidth`.
https://github.com/llvm/llvm-project/pull/186296
More information about the llvm-commits
mailing list