Commit f81a2623 authored by Jason Ekstrand's avatar Jason Ekstrand

nir: Add a block_is_unreachable helper

Reviewed-by: Caio Marcelo de Oliveira Filho's avatarCaio Marcelo de Oliveira Filho <>
parent 51714225
......@@ -3373,6 +3373,7 @@ void nir_calc_dominance(nir_shader *shader);
nir_block *nir_dominance_lca(nir_block *b1, nir_block *b2);
bool nir_block_dominates(nir_block *parent, nir_block *child);
bool nir_block_is_unreachable(nir_block *block);
void nir_dump_dom_tree_impl(nir_function_impl *impl, FILE *fp);
void nir_dump_dom_tree(nir_shader *shader, FILE *fp);
......@@ -239,6 +239,20 @@ nir_block_dominates(nir_block *parent, nir_block *child)
child->dom_post_index <= parent->dom_post_index;
nir_block_is_unreachable(nir_block *block)
assert(nir_cf_node_get_function(&block->cf_node)->valid_metadata &
assert(nir_cf_node_get_function(&block->cf_node)->valid_metadata &
/* Unreachable blocks have no dominator. The only reachable block with no
* dominator is the start block which has index 0.
return block->index > 0 && block->imm_dom == NULL;
nir_dump_dom_tree_impl(nir_function_impl *impl, FILE *fp)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment