summaryrefslogtreecommitdiff
path: root/gcc/tree-cfgcleanup.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r--gcc/tree-cfgcleanup.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 68929f8de26..eae0c84cef5 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -376,6 +376,7 @@ remove_forwarder_block (basic_block bb)
gimple label;
edge_iterator ei;
gimple_stmt_iterator gsi, gsi_to;
+ bool can_move_debug_stmts;
/* We check for infinite loops already in tree_forwarder_block_p.
However it may happen that the infinite loop is created
@@ -424,6 +425,8 @@ remove_forwarder_block (basic_block bb)
}
}
+ can_move_debug_stmts = single_pred_p (dest);
+
/* Redirect the edges. */
for (ei = ei_start (bb->preds); (e = ei_safe_edge (ei)); )
{
@@ -480,15 +483,16 @@ remove_forwarder_block (basic_block bb)
/* Move debug statements if the destination has just a single
predecessor. */
- if (single_pred_p (dest))
+ if (can_move_debug_stmts)
{
gsi_to = gsi_after_labels (dest);
for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); )
{
- if (!is_gimple_debug (gsi_stmt (gsi)))
+ gimple debug = gsi_stmt (gsi);
+ if (!is_gimple_debug (debug))
break;
gsi_remove (&gsi, false);
- gsi_insert_before (&gsi_to, label, GSI_SAME_STMT);
+ gsi_insert_before (&gsi_to, debug, GSI_SAME_STMT);
}
}