nir/dominance: Handle unreachable blocks
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 29 Dec 2015 23:25:43 +0000 (15:25 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 24 Mar 2016 22:20:44 +0000 (15:20 -0700)
commit42ddfc611f84297abeadf74be424387b127f7567
tree9a21ddb8951a9da3a89748885d8d9d0c6a58f59c
parente4dc82cfcffd9c3472b962b6bd7328788926452d
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 <jordan.l.justen@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/compiler/nir/nir_dominance.c