nv50/ir: check for origin insn in findOriginForTestWithZero

Function arguments do not have an "origin" instruction, causing a
NULL-pointer dereference without this check.

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
Pierre Moreau 2017-02-18 18:51:50 +01:00 committed by Samuel Pitoiset
parent d54b498694
commit 655c395f65

View file

@ -410,6 +410,8 @@ ConstantFolding::findOriginForTestWithZero(Value *value)
if (!value)
return NULL;
Instruction *insn = value->getInsn();
if (!insn)
return NULL;
if (insn->asCmp() && insn->op != OP_SLCT)
return insn->asCmp();