nir/dead_cf: Don't crash on unreachable after-loop blocks
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 31 Aug 2016 23:35:21 +0000 (16:35 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 2 Sep 2016 18:24:09 +0000 (11:24 -0700)
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/compiler/nir/nir_opt_dead_cf.c

index 3551124649521a38c54c949a85fc52873d795ef7..1490e6832a2429bd129a4e4430e1b829972fd00e 100644 (file)
@@ -205,7 +205,8 @@ loop_is_dead(nir_loop *loop)
    nir_metadata_require(impl, nir_metadata_live_ssa_defs |
                               nir_metadata_dominance);
 
-   for (nir_block *cur = after->imm_dom; cur != before; cur = cur->imm_dom) {
+   for (nir_block *cur = after->imm_dom; cur && cur != before;
+        cur = cur->imm_dom) {
       nir_foreach_instr(instr, cur) {
          if (!nir_foreach_ssa_def(instr, def_not_live_out, after))
             return false;