nv50/ir: the mad source might not have a defining instruction
authorIlia Mirkin <imirkin@alum.mit.edu>
Thu, 3 Dec 2015 01:10:54 +0000 (20:10 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 3 Dec 2015 01:41:37 +0000 (20:41 -0500)
For example if it's $r63 (aka 0), there won't be a definition.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp

index 9c42e4a7e017c398c24fad7a546ee9078ceea8a9..0f3caa8f07e682a5bcf9898d729eb38edceae670 100644 (file)
@@ -2660,7 +2660,7 @@ NV50PostRaConstantFolding::visit(BasicBlock *bb)
             break;
 
          def = i->getSrc(1)->getInsn();
-         if (def->op == OP_MOV && def->src(0).getFile() == FILE_IMMEDIATE) {
+         if (def && def->op == OP_MOV && def->src(0).getFile() == FILE_IMMEDIATE) {
             vtmp = i->getSrc(1);
             i->setSrc(1, def->getSrc(0));