re PR debug/90131 (wrong debug info at -O3)
authorRichard Biener <rguenther@suse.de>
Tue, 23 Apr 2019 10:10:10 +0000 (10:10 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 23 Apr 2019 10:10:10 +0000 (10:10 +0000)
2019-04-23  Richard Biener  <rguenther@suse.de>

PR debug/90131
* tree-cfgcleanup.c (move_debug_stmts_from_forwarder): Add
dest_single_pred_p argument.
(remove_forwarder_block): Adjust.
(remove_forwarder_block_with_phi): Likewise.

From-SVN: r270505

gcc/ChangeLog
gcc/tree-cfgcleanup.c

index 185cf518746a16d0c965c1196654ec456efff456..0823ca9bcfaf69aae630343958b6a9604586c5df 100644 (file)
@@ -1,3 +1,11 @@
+2019-04-23  Richard Biener  <rguenther@suse.de>
+
+       PR debug/90131
+       * tree-cfgcleanup.c (move_debug_stmts_from_forwarder): Add
+       dest_single_pred_p argument.
+       (remove_forwarder_block): Adjust.
+       (remove_forwarder_block_with_phi): Likewise.
+
 2019-04-23  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
            Bernd Edlinger  <bernd.edlinger@hotmail.de>
            Jakub Jelinek  <jakub@redhat.com>
index 0a79a6a658fd33f3bf3999fd2c2668bf0c0ab96d..183b491ab1d3ccd0e448e16b1fb5df652cfec8ff 100644 (file)
@@ -447,12 +447,12 @@ phi_alternatives_equal (basic_block dest, edge e1, edge e2)
 /* Move debug stmts from the forwarder block SRC to DEST.  */
 
 static void
-move_debug_stmts_from_forwarder (basic_block src, basic_block dest)
+move_debug_stmts_from_forwarder (basic_block src, basic_block dest,
+                                bool dest_single_pred_p)
 {
   if (!MAY_HAVE_DEBUG_STMTS)
     return;
 
-  bool can_move_debug_stmts = single_pred_p (dest);
   gimple_stmt_iterator gsi_to = gsi_after_labels (dest);
   for (gimple_stmt_iterator gsi = gsi_after_labels (src); !gsi_end_p (gsi);)
     {
@@ -460,7 +460,7 @@ move_debug_stmts_from_forwarder (basic_block src, basic_block dest)
       gcc_assert (is_gimple_debug (debug));
       /* Move debug binds anyway, but not anything else like begin-stmt
         markers unless they are always valid at the destination.  */
-      if (can_move_debug_stmts
+      if (dest_single_pred_p
          || gimple_debug_bind_p (debug))
        {
          gsi_move_before (&gsi, &gsi_to);
@@ -472,7 +472,7 @@ move_debug_stmts_from_forwarder (basic_block src, basic_block dest)
             For anther, if the debug stmt is immediately followed by a
             (debug) definition in the destination (on a post-dominated path?)
             we can elide it without any bad effects.  */
-         if (!can_move_debug_stmts)
+         if (!dest_single_pred_p)
            {
              gimple_debug_bind_reset_value (debug);
              update_stmt (debug);
@@ -544,6 +544,7 @@ remove_forwarder_block (basic_block bb)
   basic_block pred = NULL;
   if (single_pred_p (bb))
     pred = single_pred (bb);
+  bool dest_single_pred_p = single_pred_p (dest);
 
   /* Redirect the edges.  */
   for (ei = ei_start (bb->preds); (e = ei_safe_edge (ei)); )
@@ -602,7 +603,7 @@ remove_forwarder_block (basic_block bb)
 
   /* Move debug statements.  Reset them if the destination does not
      have a single predecessor.  */
-  move_debug_stmts_from_forwarder (bb, dest);
+  move_debug_stmts_from_forwarder (bb, dest, dest_single_pred_p);
 
   bitmap_set_bit (cfgcleanup_altered_bbs, dest->index);
 
@@ -1203,6 +1204,7 @@ remove_forwarder_block_with_phi (basic_block bb)
   basic_block pred = NULL;
   if (single_pred_p (bb))
     pred = single_pred (bb);
+  bool dest_single_pred_p = single_pred_p (dest);
 
   /* Redirect each incoming edge to BB to DEST.  */
   while (EDGE_COUNT (bb->preds) > 0)
@@ -1287,7 +1289,7 @@ remove_forwarder_block_with_phi (basic_block bb)
 
   /* Move debug statements.  Reset them if the destination does not
      have a single predecessor.  */
-  move_debug_stmts_from_forwarder (bb, dest);
+  move_debug_stmts_from_forwarder (bb, dest, dest_single_pred_p);
 
   /* Update the dominators.  */
   dombb = get_immediate_dominator (CDI_DOMINATORS, bb);