Module: Mesa
Branch: main
Commit: ee2764d5e86005b24c2ede5432bdde8ce66880dd
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee2764d5e86005b24c2ede5432bdde8ce66880dd

Author: Friedrich Vock <[email protected]>
Date:   Mon Apr 17 15:58:39 2023 +0200

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 <[email protected]>
Reviewed-by: Konstantin Seurer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22536>

---

 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 f4319c1c31f..0176cb508a4 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);

Reply via email to