diff --git a/.pick_status.json b/.pick_status.json index d128fd9992c..1b98af24b0a 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -24754,7 +24754,7 @@ "description": "nir/opt_dead_cf: remove nodes after a jump earlier", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/compiler/nir/nir_opt_dead_cf.c b/src/compiler/nir/nir_opt_dead_cf.c index 36675ab3de4..454f6f09464 100644 --- a/src/compiler/nir/nir_opt_dead_cf.c +++ b/src/compiler/nir/nir_opt_dead_cf.c @@ -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;