DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

Usage of a matrix in a structure that is passed to groupshared memory does not get dead store eliminated

Open bfavela opened this issue 11 months ago • 1 comments

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

bfavela avatar Mar 14 '24 18:03 bfavela

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.

llvm-beanz avatar Mar 15 '24 17:03 llvm-beanz