From ee2764d5e86005b24c2ede5432bdde8ce66880dd Mon Sep 17 00:00:00 2001 From: Friedrich Vock Date: Mon, 17 Apr 2023 15:58:39 +0200 Subject: [PATCH] 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 Reviewed-by: Konstantin Seurer Part-of: --- src/compiler/nir/nir_lower_returns.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/nir/nir_lower_returns.c b/src/compiler/nir/nir_lower_returns.c index f4319c1..0176cb5 100644 --- a/src/compiler/nir/nir_lower_returns.c +++ b/src/compiler/nir/nir_lower_returns.c @@ -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); -- 2.7.4