-
Notifications
You must be signed in to change notification settings - Fork 569
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 #4887 Signed-off-by: Nathan Gauër <brioche@google.com>
- Loading branch information
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters