aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgrtl.c
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2013-11-24 19:15:36 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2013-11-24 19:15:36 +0000
commit57d6c446c787d1dacd89c5cd504747d6857ad494 (patch)
treef5db0208687505d3114934ff0a9f353f86b4947f /gcc/cfgrtl.c
parent58b07297511c491cdd3feab39fcb0d84713f736e (diff)
downloadgcc-57d6c446c787d1dacd89c5cd504747d6857ad494.zip
gcc-57d6c446c787d1dacd89c5cd504747d6857ad494.tar.gz
gcc-57d6c446c787d1dacd89c5cd504747d6857ad494.tar.bz2
jump.c (reset_insn_reg_label_operand_notes): New function, split out from ...
* jump.c (reset_insn_reg_label_operand_notes): New function, split out from ... (init_label_info): ... here. Reset LABEL_NUSES in cfglayout mode. * cfgcleanup.c (delete_dead_jump_tables_between): New function, split out from ... (delete_dead_jumptables): ... here. Handle cfglayout mode. (cleanup_cfg): Delete dead jump tables in cfglayout mode if an expensive CFG cleanup is called for. * cfgrtl.c (fixup_reorder_chain): Remove BARRIERs from fallthru paths. (cfg_layout_finalize): Delete dead jump tables before re-building the insns chain. * ira.c (ira): Rebuild jump labels *after* deleting unreachable basic blocks, not before. * loop-init.c (rtl_loop_done): Call for an expensive CFG cleanup. * modulo-sched.c (sms_schedule): Do not look for BARRIERs in the insns chain of a scheduling extended basic block, they cannot appear there in cfglayout mode. From-SVN: r205337
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r--gcc/cfgrtl.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 63f44af..4ce7273 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -3696,10 +3696,10 @@ fixup_reorder_chain (void)
#endif
/* Now add jumps and labels as needed to match the blocks new
- outgoing edges. */
+ outgoing edges. Fixup missing or redundant BARRIERs. */
- for (bb = ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb; bb ; bb = (basic_block)
- bb->aux)
+ for (bb = ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb; bb ;
+ bb = (basic_block) bb->aux)
{
edge e_fall, e_taken, e;
rtx bb_end_insn;
@@ -3853,13 +3853,26 @@ fixup_reorder_chain (void)
relink_block_chain (/*stay_in_cfglayout_mode=*/false);
- /* Annoying special case - jump around dead jumptables left in the code. */
+ /* Annoying special case - stray barriers left in the code. This happens
+ if a tablejump is transformed to a simpe or confitional jump, or if a
+ basic block ending in a tablejump is removed but the jump table itself
+ is not. */
FOR_EACH_BB (bb)
{
edge e = find_fallthru_edge (bb->succs);
- if (e && !can_fallthru (e->src, e->dest))
- force_nonfallthru (e);
+ if (e && e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
+ {
+ rtx insn, next;
+ for (insn = NEXT_INSN (BB_END (e->src));
+ insn != BB_HEAD (e->dest);
+ insn = next)
+ {
+ next = NEXT_INSN (insn);
+ if (BARRIER_P (insn))
+ remove_insn (insn);
+ }
+ }
}
/* Ensure goto_locus from edges has some instructions with that locus
@@ -4273,7 +4286,7 @@ break_superblocks (void)
}
/* Finalize the changes: reorder insn list according to the sequence specified
- by aux pointers, enter compensation code, rebuild scope forest. */
+ by aux pointers, enter compensation code. */
void
cfg_layout_finalize (void)
@@ -4281,6 +4294,7 @@ cfg_layout_finalize (void)
#ifdef ENABLE_CHECKING
verify_flow_info ();
#endif
+ delete_dead_jumptables ();
force_one_exit_fallthru ();
rtl_register_cfg_hooks ();
if (reload_completed
@@ -4291,9 +4305,6 @@ cfg_layout_finalize (void)
fixup_fallthru_exit_predecessor ();
fixup_reorder_chain ();
- rebuild_jump_labels (get_insns ());
- delete_dead_jumptables ();
-
#ifdef ENABLE_CHECKING
verify_insn_chain ();
verify_flow_info ();