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>
This commit is contained in:
Friedrich Vock
2023-04-17 15:58:39 +02:00
committed by Marge Bot
parent cf323446e7
commit ee2764d5e8
+1
View File
@@ -287,6 +287,7 @@ nir_lower_returns_impl(nir_function_impl *impl)
if (progress) {
nir_metadata_preserve(impl, nir_metadata_none);
nir_rematerialize_derefs_in_use_blocks_impl(impl);
nir_repair_ssa_impl(impl);
} else {
nir_metadata_preserve(impl, nir_metadata_all);