[llvm] [SPIRV][HLSL] Add FixedVector GEP legalization (PR #171682)

Steven Perron via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 11 10:25:51 PST 2025


================
@@ -665,9 +665,17 @@ bool SPIRVEmitIntrinsics::walkLogicalAccessChain(
       Offset -= STL->getElementOffset(Element);
       CurType = ST->getElementType(Element);
       OnLiteralIndexing(CurType, Element);
+    } else if (auto *VT = dyn_cast<FixedVectorType>(CurType)) {
+      Type *EltTy = VT->getElementType();
+      uint32_t EltTypeSize = DL.getTypeSizeInBits(EltTy) / 8;
----------------
s-perron wrote:

Can you add some type of check or assert that the size of the element type is a multiple of 8? In LLVM, it does not have to be, and this is what causes people problems where there is a GEP into a vector type.

See https://discourse.llvm.org/t/status-of-geps-into-vectors-of-overaligned-elements/67497/11 for more background.

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


More information about the llvm-commits mailing list