diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2017-12-20 14:48:34 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2017-12-20 14:48:34 +0000 |
commit | 67a8d7199fe4e474f7bd565161fa2f27d59969fc (patch) | |
tree | 6093bd1b061517b897df00a25e329bbff6c51b48 /gcc/tree-cfgcleanup.c | |
parent | 8a91d5455313fb3c4fc07935d848921012cb297f (diff) | |
download | gcc-67a8d7199fe4e474f7bd565161fa2f27d59969fc.zip gcc-67a8d7199fe4e474f7bd565161fa2f27d59969fc.tar.gz gcc-67a8d7199fe4e474f7bd565161fa2f27d59969fc.tar.bz2 |
[SFN] debug markers before labels no more
Make sure that gimple and RTL IRs don't have debug markers before
labels. When we build the CFG, we move labels before any markers
appearing before them. Then, make sure we don't mistakenly
reintroduce them.
This reverts some of the complexity that had been brought about by the
initial SFN patches.
for gcc/ChangeLog
PR bootstrap/83396
* cfgexpand.c (label_rtx_for_bb): Revert SFN changes that
allowed debug stmts before labels.
(expand_gimple_basic_block): Likewise.
* gimple-iterator.c (gimple_find_edge_insert_loc): Likewise.
* gimple-iterator.h (gsi_after_labels): Likewise.
* tree-cfgcleanup (remove_forwarder_block): Likewise, but
rename reused variable, and simplify using gsi_move_before.
* tree-ssa-tail-merge.c (find_duplicate): Likewise.
* tree-cfg.c (make_edges, cleanup_dead_labels): Likewise.
(gimple_can_merge_blocks_p, verify_gimple_in_cfg): Likewise.
(gimple_verify_flow_info, gimple_block_label): Likewise.
(make_blocks): Move debug markers after adjacent labels.
* cfgrtl.c (skip_insns_after_block): Revert SFN changes that
allowed debug insns outside blocks.
* df-scan.c (df_insn_delete): Likewise.
* lra-constraints.c (update_ebb_live_info): Likewise.
* var-tracking.c (get_first_insn, vt_emit_notes): Likewise.
(vt_initialize, delete_vta_debug_insns): Likewise.
(reemit_marker_as_note): Drop BB parm. Adjust callers.
From-SVN: r255895
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r-- | gcc/tree-cfgcleanup.c | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index a0e5797..bfcca03 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -444,7 +444,7 @@ remove_forwarder_block (basic_block bb) { edge succ = single_succ_edge (bb), e, s; basic_block dest = succ->dest; - gimple *label; + gimple *stmt; edge_iterator ei; gimple_stmt_iterator gsi, gsi_to; bool can_move_debug_stmts; @@ -457,9 +457,9 @@ remove_forwarder_block (basic_block bb) /* If the destination block consists of a nonlocal label or is a EH landing pad, do not merge it. */ - label = first_stmt (dest); - if (label) - if (glabel *label_stmt = dyn_cast <glabel *> (label)) + stmt = first_stmt (dest); + if (stmt) + if (glabel *label_stmt = dyn_cast <glabel *> (stmt)) if (DECL_NONLOCAL (gimple_label_label (label_stmt)) || EH_LANDING_PAD_NR (gimple_label_label (label_stmt)) != 0) return false; @@ -536,28 +536,23 @@ 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. - - While at that, move any debug stmts that appear before or in between - labels, but not those that can only appear after labels. */ + labels is retained. */ gsi_to = gsi_start_bb (dest); - gsi = gsi_start_bb (bb); - gimple_stmt_iterator gsie = gsi_after_labels (bb); - while (gsi_stmt (gsi) != gsi_stmt (gsie)) + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); ) { - tree decl; - label = gsi_stmt (gsi); - if (is_gimple_debug (label) - ? can_move_debug_stmts - : ((decl = gimple_label_label (as_a <glabel *> (label))), - EH_LANDING_PAD_NR (decl) != 0 - || DECL_NONLOCAL (decl) - || FORCED_LABEL (decl) - || !DECL_ARTIFICIAL (decl))) - { - gsi_remove (&gsi, false); - gsi_insert_before (&gsi_to, label, GSI_SAME_STMT); - } + stmt = gsi_stmt (gsi); + if (is_gimple_debug (stmt)) + break; + + /* Forwarder blocks can only contain labels and debug stmts, and + labels must come first, so if we get to this point, we know + we're looking at a label. */ + tree decl = gimple_label_label (as_a <glabel *> (stmt)); + if (EH_LANDING_PAD_NR (decl) != 0 + || DECL_NONLOCAL (decl) + || FORCED_LABEL (decl) + || !DECL_ARTIFICIAL (decl)) + gsi_move_before (&gsi, &gsi_to); else gsi_next (&gsi); } @@ -565,14 +560,12 @@ remove_forwarder_block (basic_block bb) /* 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); + gsi_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); + gsi_move_before (&gsi, &gsi_to); } while (!gsi_end_p (gsi)); } |