[llvm] [SPIRV] Scalarize single-element vectors in type creation (PR #180735)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 10 05:21:13 PST 2026


================
@@ -311,6 +311,7 @@ SPIRVType *SPIRVGlobalRegistry::getOpTypeVector(uint32_t NumElems,
                                                 MachineIRBuilder &MIRBuilder) {
   auto EleOpc = ElemType->getOpcode();
   (void)EleOpc;
+  assert(NumElems >= 2 && "SPIR-V OpTypeVector requires at least 2 components");
----------------
MrSidims wrote:

Overall, this patch is probably a bit naive way of lowering <1 x T> vectors, when I have approached it I was also expecting to modify `findSPIRVType` and get `getRegType` functions, but apparently the current version just works.

Expected behaviour though that some special vector intrinsics wouldn't be lowered correctly (for example vector.reduce), but from what I see they are not implemented anyway, so could be handled separately. 

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


More information about the llvm-commits mailing list