lima/ppir: merge branch nodes in simple cases

In some simple cases, we can merge the branch operation with an existing
instruction and avoid the creation of an empty new instruction just for
the branch node.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16163>
This commit is contained in:
Erico Nunes 2022-04-26 11:09:47 +02:00 committed by Marge Bot
parent c3f13ee551
commit 106dc60fc0

View file

@ -58,6 +58,18 @@ static bool ppir_do_node_to_instr_try_insert(ppir_block *block, ppir_node *node)
return ppir_instr_insert_node(succ->instr, node);
}
if (ppir_node_has_single_succ(node) &&
ppir_node_has_single_pred(ppir_node_first_succ(node)) &&
(ppir_node_first_succ(node)->type == ppir_node_type_branch)) {
assert(ppir_node_has_single_succ(node));
ppir_node *succ = ppir_node_first_succ(node);
assert(succ);
assert(succ->instr);
return ppir_instr_insert_node(succ->instr, node);
}
switch (node->type) {
case ppir_node_type_load:
break;