aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfgcleanup.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2017-12-13 18:46:43 +0000
committerJakub Jelinek <jakub@gcc.gnu.org>2017-12-13 19:46:43 +0100
commit3b778d9d1268ec838c22fca98cd4dd351feb5914 (patch)
treed1117d1721f7642823be5e5f70d6903e9de82aea /gcc/tree-cfgcleanup.c
parent3ca652c1995cd691850a53c656c958a83c3fecde (diff)
downloadgcc-3b778d9d1268ec838c22fca98cd4dd351feb5914.zip
gcc-3b778d9d1268ec838c22fca98cd4dd351feb5914.tar.gz
gcc-3b778d9d1268ec838c22fca98cd4dd351feb5914.tar.bz2
re PR bootstrap/83396 (Bootstrap failures with Statement Frontiers)
PR bootstrap/83396 PR debug/83391 * tree-cfgcleanup.c (remove_forwarder_block): Keep after labels debug stmts that can only appear after labels. * gcc.dg/torture/pr83396.c: New test. * g++.dg/torture/pr83391.C: New test. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r255609
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r--gcc/tree-cfgcleanup.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 0bee217..a0e5797 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -536,9 +536,14 @@ remove_forwarder_block (basic_block bb)
defined labels and labels with an EH landing pad number to the
new block, so that the redirection of the abnormal edges works,
jump targets end up in a sane place and debug information for
- labels is retained. */
+ labels is retained.
+
+ While at that, move any debug stmts that appear before or in between
+ labels, but not those that can only appear after labels. */
gsi_to = gsi_start_bb (dest);
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
+ gsi = gsi_start_bb (bb);
+ gimple_stmt_iterator gsie = gsi_after_labels (bb);
+ while (gsi_stmt (gsi) != gsi_stmt (gsie))
{
tree decl;
label = gsi_stmt (gsi);
@@ -557,6 +562,21 @@ remove_forwarder_block (basic_block bb)
gsi_next (&gsi);
}
+ /* Move debug statements if the destination has a single predecessor. */
+ if (can_move_debug_stmts && !gsi_end_p (gsi))
+ {
+ gcc_assert (gsi_stmt (gsi) == gsi_stmt (gsie));
+ gimple_stmt_iterator gsie_to = gsi_after_labels (dest);
+ do
+ {
+ gimple *debug = gsi_stmt (gsi);
+ gcc_assert (is_gimple_debug (debug));
+ gsi_remove (&gsi, false);
+ gsi_insert_before (&gsie_to, debug, GSI_SAME_STMT);
+ }
+ while (!gsi_end_p (gsi));
+ }
+
bitmap_set_bit (cfgcleanup_altered_bbs, dest->index);
/* Update the dominators. */