diff options
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_group.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_group.c b/src/gallium/drivers/freedreno/ir3/ir3_group.c index cd59080b0f1..f229fe6eecd 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_group.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_group.c @@ -90,6 +90,22 @@ instr_insert_mov(void *arr, int idx, struct ir3_instruction *instr) } static struct group_ops instr_ops = { instr_get, instr_insert_mov }; +/* verify that cur != instr, but cur is also not in instr's neighbor-list: */ +static bool +in_neighbor_list(struct ir3_instruction *instr, struct ir3_instruction *cur) +{ + if (!instr) + return false; + + if (instr == cur) + return true; + + for (instr = ir3_neighbor_first(instr); instr; instr = instr->cp.right) + if (instr == cur) + return true; + + return false; +} static void group_n(struct group_ops *ops, void *arr, unsigned n) @@ -121,7 +137,7 @@ restart: /* we also can't have an instr twice in the group: */ for (j = i + 1; (j < n) && !conflict; j++) - if (ops->get(arr, j) == instr) + if (in_neighbor_list(ops->get(arr, j), instr)) conflict = true; if (conflict) { |