Issue 164517
Summary [DirectX] DXILResourceAccess's handling of GEP chains is overly simplistic
Labels backend:DirectX
Assignees bogner
Reporter bogner
    The algorithm in DXILResourceAccess currently tries to work out GEP offsets ahead of time and then use those to lower getpointer calls to resource loads. This works for most simple cases but falls apart if there's a dynamic index to access an object followed by a fixed index for a member. This comes up with structs and vectors in cbuffer arrays, and will presumably also come up with StructuredBuffer when we attempt to fix #160208.

Consider:
```hlsl
RWStructuredBuffer<uint> output;
cbuffer Constants {
  uint32_t3 w[3];
}
[numthreads(1, 1, 1)]
void main(uint3 Tid : SV_DispatchThreadID) {
  output[Tid.x] = w[Tid.x].y;
}
```

We'll need to rework this algorithm to handle GEP chains that mix dynamic and static indexing. The way to do this is probably to defer the address calculations until we're generating the loads themselves rather than try to precalculate the offsets.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to