mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
nir/opt_dead_cf: remove nodes after a jump earlier
In the case of:
halt
// succs: b9
if %618 {
block b3:// preds:
break
// succs: b6
} else {
block b4: // preds: , succs: b5
}
block b5: // preds: b4
32 %556 = iadd %617, %2 (0x1)
opt_constant_if() doesn't work because stitch_blocks() can't join blocks if the
before ends in a jump and the after isn't empty.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24235>
This commit is contained in:
parent
1c8577b493
commit
21f0aca948
1 changed files with 8 additions and 5 deletions
|
|
@ -275,6 +275,13 @@ node_is_dead(nir_cf_node *node)
|
|||
static bool
|
||||
dead_cf_block(nir_block *block)
|
||||
{
|
||||
/* opt_constant_if() doesn't handle this case. */
|
||||
if (nir_block_ends_in_jump(block) &&
|
||||
!exec_node_is_tail_sentinel(block->cf_node.node.next)) {
|
||||
remove_after_cf_node(&block->cf_node);
|
||||
return true;
|
||||
}
|
||||
|
||||
nir_if *following_if = nir_block_get_following_if(block);
|
||||
if (following_if) {
|
||||
if (nir_src_is_const(following_if->condition)) {
|
||||
|
|
@ -332,12 +339,8 @@ dead_cf_list(struct exec_list *list, bool *list_ends_in_jump)
|
|||
}
|
||||
|
||||
if (nir_block_ends_in_jump(block)) {
|
||||
assert(exec_node_is_tail_sentinel(cur->node.next));
|
||||
*list_ends_in_jump = true;
|
||||
|
||||
if (!exec_node_is_tail_sentinel(cur->node.next)) {
|
||||
remove_after_cf_node(cur);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue