i965/cfg: Fix cfg_t::dump() when a block has no immediate dominator.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 5 Oct 2015 23:21:10 +0000 (16:21 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 10 Oct 2015 18:40:19 +0000 (11:40 -0700)
Switch statements introduce a bogus loop with an unconditional break at
the end of the loop, just before the while...so the while is unreachable
and has no immediate dominator.

v2: With less exuberance

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_cfg.cpp

index 531fa16..10bcd4b 100644 (file)
@@ -426,7 +426,11 @@ cfg_t::dump(backend_shader *s)
       calculate_idom();
 
    foreach_block (block, this) {
-      fprintf(stderr, "START B%d IDOM(B%d)", block->num, block->idom->num);
+      if (block->idom)
+         fprintf(stderr, "START B%d IDOM(B%d)", block->num, block->idom->num);
+      else
+         fprintf(stderr, "START B%d IDOM(none)", block->num);
+
       foreach_list_typed(bblock_link, link, link, &block->parents) {
          fprintf(stderr, " <-B%d",
                  link->block->num);