From: Brian Paul Date: Wed, 1 Feb 2012 15:20:05 +0000 (-0700) Subject: nv50: add assertions missed in earlier nv50 commit X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f09910f399d747e524731953bb11b64c1f4821d0;p=mesa.git nv50: add assertions missed in earlier nv50 commit --- diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp index fb4041f0b88..43d6b21a3f6 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 e79fd594cea..72922cb0388 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)