Mesa (master): nir: update fixup_phi_srcs() to handle registers

Timothy Arceri tarceri at kemper.freedesktop.org
Thu Dec 22 23:16:01 UTC 2016


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

Author: Timothy Arceri <timothy.arceri at collabora.com>
Date:   Wed Dec 14 16:14:20 2016 +1100

nir: update fixup_phi_srcs() to handle registers

We need to do this because we partially get out of SSA when unrolling
and cloning loops.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/compiler/nir/nir_clone.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c
index fb1558c..91ffe62 100644
--- a/src/compiler/nir/nir_clone.c
+++ b/src/compiler/nir/nir_clone.c
@@ -603,12 +603,17 @@ fixup_phi_srcs(clone_state *state)
 {
    list_for_each_entry_safe(nir_phi_src, src, &state->phi_srcs, src.use_link) {
       src->pred = remap_local(state, src->pred);
-      assert(src->src.is_ssa);
-      src->src.ssa = remap_local(state, src->src.ssa);
 
-      /* Remove from this list and place in the uses of the SSA def */
+      /* Remove from this list */
       list_del(&src->src.use_link);
-      list_addtail(&src->src.use_link, &src->src.ssa->uses);
+
+      if (src->src.is_ssa) {
+         src->src.ssa = remap_local(state, src->src.ssa);
+         list_addtail(&src->src.use_link, &src->src.ssa->uses);
+      } else {
+         src->src.reg.reg = remap_reg(state, src->src.reg.reg);
+         list_addtail(&src->src.use_link, &src->src.reg.reg->uses);
+      }
    }
    assert(list_empty(&state->phi_srcs));
 }




More information about the mesa-commit mailing list