[llvm] [SPIRV] Support Peeled Array Layouts for HLSL CBuffers (PR #169078)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 01:33:21 PST 2025


================
@@ -1042,6 +1042,71 @@ getFirstValidInstructionInsertPoint(MachineBasicBlock &BB) {
                                                                      : VarPos;
 }
 
+bool matchPeeledArrayPattern(const StructType *Ty, Type *&OriginalElementType,
+                             uint64_t &TotalSize) {
+  // An array of N padded structs is represented as {[N-1 x <{T, pad}>], T}.
+  if (!Ty->isStructTy() || Ty->getStructNumElements() != 2)
----------------
Keenuts wrote:

Ty is always a struct type since the function takes a `StructType`.

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


More information about the llvm-commits mailing list