re PR debug/90131 (wrong debug info at -O3)

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
This commit is contained in:
Richard Biener 2019-04-23 10:10:10 +00:00 committed by Richard Biener
parent 48528842bd
commit 6e27100979
2 changed files with 16 additions and 6 deletions

View 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>

View 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);