From d41f293bf014e08df3df4324cdc02de5ce49d5ed Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 22 Mar 2012 11:59:32 +0100 Subject: [PATCH] nv50/ir/opt: don't delete instruction in removeFlow before its last use --- src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.30.2