Mesa (master): i965/cfg: Fix cfg_t::dump() when a block has no immediate dominator.

Kenneth Graunke kwg at kemper.freedesktop.org
Sat Oct 10 18:42:00 UTC 2015


Module: Mesa
Branch: master
Commit: a4e988f4814d80b27102c48020c4338a6d86c6da
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a4e988f4814d80b27102c48020c4338a6d86c6da

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Oct  5 16:21:10 2015 -0700

i965/cfg: Fix cfg_t::dump() when a block has no immediate dominator.

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 at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_cfg.cpp |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp
index 531fa16..10bcd4b 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
@@ -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);




More information about the mesa-commit mailing list