+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>
/* 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);)
{
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);
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);
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)); )
/* 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);
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)
/* 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);