Mesa (master): nv50: add assertions missed in earlier nv50 commit

Brian Paul brianp at kemper.freedesktop.org
Wed Feb 1 15:22:35 UTC 2012


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Feb  1 08:20:05 2012 -0700

nv50: add assertions missed in earlier nv50 commit

---

 .../drivers/nv50/codegen/nv50_ir_peephole.cpp      |    1 +
 src/gallium/drivers/nv50/nv50_pc_regalloc.c        |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp
index fb4041f..43d6b21 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp
@@ -1478,6 +1478,7 @@ MemoryOpt::replaceStFromSt(Instruction *restrict st, Record *rec)
       // get non-replaced sources after values covered by st
       for (; offR < endR; offR += ri->getSrc(s)->reg.size, ++s)
          vals[k++] = ri->getSrc(s);
+      assert(k <= Elements(vals));
       for (s = 0; s < k; ++s)
          st->setSrc(s + 1, vals[s]);
       st->setSrc(0, ri->getSrc(0));
diff --git a/src/gallium/drivers/nv50/nv50_pc_regalloc.c b/src/gallium/drivers/nv50/nv50_pc_regalloc.c
index e79fd59..72922cb 100644
--- a/src/gallium/drivers/nv50/nv50_pc_regalloc.c
+++ b/src/gallium/drivers/nv50/nv50_pc_regalloc.c
@@ -421,6 +421,7 @@ phi_opnd_for_bb(struct nv_instruction *phi, struct nv_basic_block *b,
    int i, j;
 
    for (j = -1, i = 0; i < 6 && phi->src[i]; ++i) {
+      assert(i < Elements(phi->src[i]));
       srci = phi->src[i];
       /* if already replaced, check with original source first */
       if (srci->flags & NV_REF_FLAG_REGALLOC_PRIV)




More information about the mesa-commit mailing list