diff options
author | Connor Abbott <[email protected]> | 2018-01-15 19:38:17 -0500 |
---|---|---|
committer | Connor Abbott <[email protected]> | 2019-07-18 14:33:23 +0200 |
commit | 16de3dd7a6ad4d70a41f987cf9da50d4cfa5a429 (patch) | |
tree | c0f095c6a6c479a941ef3877ed13ca2b8056c79a | |
parent | cc78a425772a377c309fe1a9cb02186a834621a8 (diff) |
lima/gpir: Fix some bugs in instruction handling
Reviewed-by: Qiang Yu <[email protected]>
-rw-r--r-- | src/gallium/drivers/lima/ir/gp/instr.c | 12 |
1 files changed, 12 insertions, 0 deletions
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) |