nir: Rematerialize derefs in use blocks before repairing SSA
authorFriedrich Vock <friedrich.vock@gmx.de>
Mon, 17 Apr 2023 13:58:39 +0000 (15:58 +0200)
committerMarge Bot <emma+marge@anholt.net>
Sat, 3 Jun 2023 10:26:01 +0000 (10:26 +0000)
commitee2764d5e86005b24c2ede5432bdde8ce66880dd
tree37f0ea86f1ad1268aa8f38862cd779a4d90c2a6a
parentcf323446e70d9fa10d7d5441631e30297b8d5274
nir: Rematerialize derefs in use blocks before repairing SSA

nir_repair_ssa_impl may insert phi nodes for any deref, but if the deref mode is uniform, validation fails.
To fix this, rematerialize the derefs in the blocks they are used to avoid generating phi nodes for them.

Cc: mesa-stable
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22536>
src/compiler/nir/nir_lower_returns.c