nir: Handle wildcards with casts in copy_prop_vars
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Wed, 19 Apr 2023 22:18:45 +0000 (17:18 -0500)
committerEric Engestrom <eric@engestrom.ch>
Sat, 4 Nov 2023 14:15:56 +0000 (14:15 +0000)
commit2cfc7776bd6d27715b89606bf9f7a3f33dd83025
tree10f6a5b42dcea37f4c9ec28efea3e148c466b833
parent844e330299aa7f85c231ef304f152353b356b6e7
nir: Handle wildcards with casts in copy_prop_vars

If we're propagating a copy from a cast where the copy copies an entire
array, we end up with something like &((S *)ssa_N)->f[*] in the source
where a wildcard has a cast in its parent chain.  If we then try to
propagate the read into a non-wildcard array load, we have to specialize
the wildcard.  This breaks because nir_build_deref_follower() doesn't
handle casts.  Since we know a priori that, because wildcards are only
generated by copy_deref on arrays, we cannot have a cast with a wildcard
parent so simply chasing the source deref to the first wildcard will
ensure that any casts in the deref are handled properly.

Fixes: ba2bd20f8732 ("nir: Rework opt_copy_prop_vars to use deref instructions")
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22580>
(cherry picked from commit 15ab4d397fbd24ac09daab03cc9cd0b750dbace2)
.pick_status.json
src/compiler/nir/nir_opt_copy_prop_vars.c