Mesa (master): nvc0: don't overwrite phi sources at the end of a loop

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Thu Feb 24 16:36:23 UTC 2011


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

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Sat Feb 19 14:14:40 2011 +0100

nvc0: don't overwrite phi sources at the end of a loop

Except the reference to its own result.

---

 src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c b/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c
index 687def0..e2838a0 100644
--- a/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c
+++ b/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c
@@ -465,6 +465,7 @@ bld_loop_end(struct bld_context *bld, struct nv_basic_block *bb)
       reg = (struct bld_register *)phi->target;
       phi->target = NULL;
 
+      /* start with s == 1, src[0] is from outside the loop */
       for (s = 1, n = 0; n < bb->num_in; ++n) {
          if (bb->in_kind[n] != CFG_EDGE_BACK)
             continue;
@@ -476,8 +477,11 @@ bld_loop_end(struct bld_context *bld, struct nv_basic_block *bb)
          for (i = 0; i < 4; ++i)
             if (phi->src[i] && phi->src[i]->value == val)
                break;
-         if (i == 4)
+         if (i == 4) {
+            /* skip values we do not want to replace */
+            for (; phi->src[s] && phi->src[s]->value != phi->def[0]; ++s);
             nv_reference(bld->pc, phi, s++, val);
+         }
       }
       bld->pc->current_block = save;
 




More information about the mesa-commit mailing list