Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spirv-opt: fix copy-propagate-arrays index opti on structs.
As per SPIR-V spec: OpAccessChain indices must be OpConstant when indexing into a structure. This optimization tried to remove load cascade. But in some scenario failed: ```c cbuffer MyStruct { uint my_field; }; uint main(uint index) { const uint my_array[1] = { my_field }; return my_array[index] } ``` This is valid as the struct is indexed with a constant index, and then the array is indexed using a dynamic index. The optimization would consider the local array to be useless and generated a load directly into the struct. Fixes KhronosGroup#4887 Signed-off-by: Nathan Gauër <brioche@google.com>
- Loading branch information