summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Moreau <pierre.morrow@free.fr>2016-03-19 14:04:54 +0100
committerIlia Mirkin <imirkin@alum.mit.edu>2016-03-31 10:30:29 -0400
commitf96a403bc3e1ef45f92621e9ace48cf757db4059 (patch)
tree9fcb0aab21489ca2a097d75966d4073a24aa38ac
parenta94d8d51d7e426485a72e6cfd6185dee9df5e070 (diff)
nv50/ir: Check for valid insn instead of def size
This fixes a null pointer dereference during the register allocation pass, if a function had arguments. Functions arguments get a definition from the function itself, a definition which is therefore not linked to any instruction. If a value ends up having a definition but no linked instruction, the register allocation pass doesn't need to consider whether that value is generated by an instruction that can only handle "short" registers (on nv50). Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
index d877c253a1..500ab8915d 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
@@ -853,7 +853,7 @@ isShortRegOp(Instruction *insn)
static bool
isShortRegVal(LValue *lval)
{
- if (lval->defs.size() == 0)
+ if (lval->getInsn() == NULL)
return false;
for (Value::DefCIterator def = lval->defs.begin();
def != lval->defs.end(); ++def)
@@ -1467,7 +1467,7 @@ GCRA::allocateRegisters(ArrayList& insns)
nodes[i].init(regs, lval);
RIG.insert(&nodes[i]);
- if (lval->inFile(FILE_GPR) && lval->defs.size() > 0 &&
+ if (lval->inFile(FILE_GPR) && lval->getInsn() != NULL &&
prog->getTarget()->getChipset() < 0xc0) {
Instruction *insn = lval->getInsn();
if (insn->op == OP_MAD || insn->op == OP_SAD)