summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-12-29 15:25:43 -0800
committerJason Ekstrand <[email protected]>2016-03-24 15:20:44 -0700
commit42ddfc611f84297abeadf74be424387b127f7567 (patch)
tree9a21ddb8951a9da3a89748885d8d9d0c6a58f59c /src
parente4dc82cfcffd9c3472b962b6bd7328788926452d (diff)
nir/dominance: Handle unreachable blocks
Previously, nir_dominance.c didn't properly handle unreachable blocks. This can happen if, for instance, you have something like this: loop { if (...) { break; } else { break; } } In this case, the block right after the if statement will be unreachable. This commit makes two changes to handle this. First, it removes an assert and allows block->imm_dom to be null if the block is unreachable. Second, it properly skips unreachable blocks in calc_dom_frontier_cb. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_dominance.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_dominance.c b/src/compiler/nir/nir_dominance.c
index b345b85e8a0..d95f3968074 100644
--- a/src/compiler/nir/nir_dominance.c
+++ b/src/compiler/nir/nir_dominance.c
@@ -94,7 +94,6 @@ calc_dominance_cb(nir_block *block, void *_state)
}
}
- assert(new_idom);
if (block->imm_dom != new_idom) {
block->imm_dom = new_idom;
state->progress = true;
@@ -112,6 +111,11 @@ calc_dom_frontier_cb(nir_block *block, void *state)
struct set_entry *entry;
set_foreach(block->predecessors, entry) {
nir_block *runner = (nir_block *) entry->key;
+
+ /* Skip unreachable predecessors */
+ if (runner->imm_dom == NULL)
+ continue;
+
while (runner != block->imm_dom) {
_mesa_set_add(runner->dom_frontier, block);
runner = runner->imm_dom;