This is useful for debugging how the analyzer handles phi nodes.

Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to trunk as 81703584769707c34533e78c7a2bc229b0e14b2d.

gcc/analyzer/ChangeLog:
        * program-point.cc (function_point::print): Show src BB index at
        BEFORE_SUPERNODE.

Signed-off-by: David Malcolm <dmalc...@redhat.com>
---
 gcc/analyzer/program-point.cc | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/analyzer/program-point.cc b/gcc/analyzer/program-point.cc
index d8cfc61975e..d73b6211141 100644
--- a/gcc/analyzer/program-point.cc
+++ b/gcc/analyzer/program-point.cc
@@ -119,8 +119,15 @@ function_point::print (pretty_printer *pp, const format 
&f) const
     case PK_BEFORE_SUPERNODE:
       {
        if (m_from_edge)
-         pp_printf (pp, "before SN: %i (from SN: %i)",
-                    m_supernode->m_index, m_from_edge->m_src->m_index);
+         {
+           if (basic_block bb = m_from_edge->m_src->m_bb)
+             pp_printf (pp, "before SN: %i (from SN: %i (bb: %i))",
+                        m_supernode->m_index, m_from_edge->m_src->m_index,
+                        bb->index);
+           else
+             pp_printf (pp, "before SN: %i (from SN: %i)",
+                        m_supernode->m_index, m_from_edge->m_src->m_index);
+         }
        else
          pp_printf (pp, "before SN: %i (NULL from-edge)",
                     m_supernode->m_index);
-- 
2.26.3

Reply via email to