Module: Mesa
Branch: master
Commit: 16de3dd7a6ad4d70a41f987cf9da50d4cfa5a429
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=16de3dd7a6ad4d70a41f987cf9da50d4cfa5a429

Author: Connor Abbott <[email protected]>
Date:   Mon Jan 15 19:38:17 2018 -0500

lima/gpir: Fix some bugs in instruction handling

Reviewed-by: Qiang Yu <[email protected]>

---

 src/gallium/drivers/lima/ir/gp/instr.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/gallium/drivers/lima/ir/gp/instr.c 
b/src/gallium/drivers/lima/ir/gp/instr.c
index 158a9a93fd4..d3190d39d4c 100644
--- a/src/gallium/drivers/lima/ir/gp/instr.c
+++ b/src/gallium/drivers/lima/ir/gp/instr.c
@@ -408,6 +408,15 @@ bool gpir_instr_try_insert_node(gpir_instr *instr, 
gpir_node *node)
 
 void gpir_instr_remove_node(gpir_instr *instr, gpir_node *node)
 {
+   assert(node->sched.pos >= 0);
+
+   /* This can happen if we merge duplicate loads in the scheduler. */
+   if (instr->slots[node->sched.pos] != node) {
+      node->sched.pos = -1;
+      node->sched.instr = -1;
+      return;
+   }
+
    if (node->sched.pos >= GPIR_INSTR_SLOT_ALU_BEGIN &&
        node->sched.pos <= GPIR_INSTR_SLOT_ALU_END)
       gpir_instr_remove_alu(instr, node);
@@ -428,6 +437,9 @@ void gpir_instr_remove_node(gpir_instr *instr, gpir_node 
*node)
 
    if (node->op == gpir_op_complex1 || node->op == gpir_op_select)
       instr->slots[GPIR_INSTR_SLOT_MUL1] = NULL;
+
+   node->sched.pos = -1;
+   node->sched.instr = -1;
 }
 
 void gpir_instr_print_prog(gpir_compiler *comp)

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to