tu: Make sure we clear dead writes to vars before nir_link_opt_varyings().
It assumes you don't have dead writes to variables in the last block, and will copy-propagate consts from the first write it finds. Without this, the upcoming nir_opt_copy_prop_vars() change to have more restricted write masks caused less nir_opt_dead_write_vars() (since it doesn't trim write masks for dead writes, only removes fully-dead writes), and then zero-initialization of variables at the top of a shader got propagated, rather than the final store of the used channels of the variable. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37313>
This commit is contained in:
@@ -2923,6 +2923,12 @@ lower_io_to_scalar_early(nir_shader *nir, nir_variable_mode mask)
|
||||
*/
|
||||
NIR_PASS(_, nir, nir_opt_copy_prop_vars);
|
||||
|
||||
/* This must be called before nir_link_opt_varyings() and after
|
||||
* nir_opt_copy_prop_vars(), otherwise repeated (scalarized) stores in the
|
||||
* last block will propagate the wrong values into the consumer.
|
||||
*/
|
||||
NIR_PASS(_, nir, nir_opt_dead_write_vars);
|
||||
|
||||
NIR_PASS(_, nir, nir_opt_dce);
|
||||
|
||||
const nir_remove_dead_variables_options var_opts = {
|
||||
|
||||
Reference in New Issue
Block a user