DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
Usage of a matrix in a structure that is passed to groupshared memory does not get dead store eliminated
Description When passing a full matrix across to groupshared, elements that are never loaded don't have their stores properly deleted when the index is a compile time constant.
Steps to Reproduce
Add "#define TGSM_MATRIX" to the attached shader and see the number of "addrspace(3)" stores increase from 3 to 16 for the same structure.
Actual Behavior Expected behavior is that there would only be 3 stores in either version of the shader.
Environment
- DXC version - Any
- Host Operating System - Any tgsm_matrix.txt
This may be caused by limitations in the legacy SROA pass that the DXIL SROA is based on. This may "just work" in upstream with modern SROA and dead store elimination. We should check this against upstream once the language and DXIL generation support are more complete.
We're unlikely to address this in DXC unless something changes to push the priority higher.