From cd8c569ced321a80f6a45522c270e1db154481b3 Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Sun, 18 Aug 2019 22:51:34 -0700 Subject: [PATCH] lima/ppir: fix ordering deps There can be several root nodes, i.e.: (1) r0 = r1 (2) r2 = r3 (3) branch if (ssa1) We need to make (3) depend on (1) and (2), old code added dependency only for (2), and (1) was kept as root node since there is no branch/discard or store color between two movs. Tested-by: Andreas Baierl Reviewed-by: Qiang Yu Reviewed-by: Erico Nunes Signed-off-by: Vasily Khoruzhick --- src/gallium/drivers/lima/ir/pp/nir.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c index d1a8bc140b6..f7eaccd7c63 100644 --- a/src/gallium/drivers/lima/ir/pp/nir.c +++ b/src/gallium/drivers/lima/ir/pp/nir.c @@ -576,12 +576,14 @@ static void ppir_add_ordering_deps(ppir_compiler *comp) */ list_for_each_entry(ppir_block, block, &comp->block_list, list) { ppir_node *prev_node = NULL; - list_for_each_entry(ppir_node, node, &block->node_list, list) { - if (node->type == ppir_node_type_discard || - node->type == ppir_node_type_store || - node->type == ppir_node_type_branch) { - if (prev_node) - ppir_node_add_dep(node, prev_node); + list_for_each_entry_rev(ppir_node, node, &block->node_list, list) { + if (prev_node && ppir_node_is_root(node) && node->op != ppir_op_const) { + ppir_node_add_dep(prev_node, node); + } + if (node->op == ppir_op_discard || + node->op == ppir_op_store_color || + node->op == ppir_op_store_temp || + node->op == ppir_op_branch) { prev_node = node; } } -- 2.30.2