nir: Factor out nir_src_rewrite_ssa helper
authorAlyssa Rosenzweig <alyssa@collabora.com>
Thu, 6 Apr 2023 19:54:18 +0000 (15:54 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 7 Apr 2023 23:48:03 +0000 (23:48 +0000)
commite9e0956d6232ffdf502bf829642fcd0a5fcbcea2
tree4dac3fdbb68bc3ea7e503b5ee1edbda5fc71afa4
parent2285b5daae40788327030ae259f47397c489dcd0
nir: Factor out nir_src_rewrite_ssa helper

Like nir_instr_rewrite_ssa but without the asserted extra argument. Works on ifs
too, now that we have a unified use list.

We do need to assert that the source has actually been inserted and has valid
use/def chains. Previously, asserting on the parent instruction accomplished
that indirectly. For the more general helper, we instead directly assert that
there exists a non-null parent, whatever it is.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22343>
src/compiler/nir/nir.h