nv50/ir: check for origin insn in findOriginForTestWithZero
authorPierre Moreau <pierre.morrow@free.fr>
Sat, 18 Feb 2017 17:51:50 +0000 (18:51 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 9 Mar 2017 11:42:46 +0000 (12:42 +0100)
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>
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp

index 79403c93dfd2ed6f14c261924a50fcb82700d8f9..d358abc5bd7d6906979fac10f3c947f5e35ec63c 100644 (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();