[clang] [llvm] [HLSL][DirectX] Use a padding type for HLSL buffers. (PR #167404)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 11:02:30 PST 2025


bogner wrote:

> The backend part looks good, but I am confused about the tests. I get that a lot of the CBufferAccess tests have been removed because big part of the the cbuffer access logic is now in DXILResourceAccesPass, but the Clang codegen tests in this change all generate typed GEPs such as:
> 
> `getelementptr (<{ float, target("dx.Padding", 12) }>, ptr addrspace(2) @c1, i32 7, i32 0)`,
> 
> And the few remaining tests in the backend are only testing untyped GEPs:
> 
> `getelementptr inbounds nuw (i8, ptr addrspace(2) @a1, i32 16)`.
> 
> Shouldn't we be testing the typed variants too? Or is something always translating typed GEPs into untyped before CBufferAccess runs?

The typed GEPs are all translated to untyped in InstCombine (See #68882), so we never see them in the backend. I've added back the array-typedgep test that shows that they're handled correctly regardless, as I do think it makes sense to have that test.


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


More information about the llvm-commits mailing list