summaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index e5619cfc027..bab08c8edac 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -2680,7 +2680,8 @@ rest_of_compilation (decl)
if (optimize > 0)
{
find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
- cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
+ cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP
+ | (flag_thread_jumps ? CLEANUP_THREADING : 0));
/* ??? Run if-conversion before delete_null_pointer_checks,
since the later does not preserve the CFG. This should
@@ -2721,13 +2722,6 @@ rest_of_compilation (decl)
reg_scan (insns, max_reg_num (), 1);
- if (flag_thread_jumps)
- {
- timevar_push (TV_JUMP);
- thread_jumps (insns, max_reg_num (), 1);
- timevar_pop (TV_JUMP);
- }
-
tem = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
/* If we are not running more CSE passes, then we are no longer
@@ -2750,14 +2744,16 @@ rest_of_compilation (decl)
delete_trivially_dead_insns (insns, max_reg_num (), 0);
/* Try to identify useless null pointer tests and delete them. */
- if (flag_delete_null_pointer_checks)
+ if (flag_delete_null_pointer_checks || flag_thread_jumps)
{
timevar_push (TV_JUMP);
find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
- cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
+ cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP
+ | (flag_thread_jumps ? CLEANUP_THREADING : 0));
- delete_null_pointer_checks (insns);
+ if (flag_delete_null_pointer_checks)
+ delete_null_pointer_checks (insns);
/* CFG is no longer maintained up-to-date. */
free_bb_for_insn ();
timevar_pop (TV_JUMP);
@@ -2928,16 +2924,6 @@ rest_of_compilation (decl)
}
}
- if (flag_thread_jumps)
- {
- /* This pass of jump threading straightens out code
- that was kinked by loop optimization. */
- timevar_push (TV_JUMP);
- reg_scan (insns, max_reg_num (), 0);
- thread_jumps (insns, max_reg_num (), 0);
- timevar_pop (TV_JUMP);
- }
-
close_dump_file (DFI_cse2, print_rtl, insns);
timevar_pop (TV_CSE2);
@@ -2955,7 +2941,8 @@ rest_of_compilation (decl)
open_dump_file (DFI_cfg, decl);
find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
- cleanup_cfg (optimize ? CLEANUP_EXPENSIVE : 0);
+ cleanup_cfg (optimize ? CLEANUP_EXPENSIVE : 0
+ | (flag_thread_jumps ? CLEANUP_THREADING : 0));
check_function_return_warnings ();
/* It may make more sense to mark constant functions after dead code is