From: Christoph Bumiller Date: Thu, 22 Mar 2012 10:59:32 +0000 (+0100) Subject: nv50/ir/opt: don't delete instruction in removeFlow before its last use X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d41f293bf014e08df3df4324cdc02de5ce49d5ed;p=mesa.git nv50/ir/opt: don't delete instruction in removeFlow before its last use --- diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp index 259bb5636c5..a45d336b435 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp @@ -1737,10 +1737,10 @@ FlatteningPass::removeFlow(Instruction *insn) if (term->op != OP_JOIN) return; - delete_Instruction(prog, term); - Value *pred = term->getPredicate(); + delete_Instruction(prog, term); + if (pred && pred->refCount() == 0) { Instruction *pSet = pred->getUniqueInsn(); pred->join->reg.data.id = -1; // deallocate