From patchwork Thu Jul 21 16:30:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4/9] Move the SMS pass earlier Date: Thu, 21 Jul 2011 06:30:29 -0000 From: zhroma@ispras.ru X-Patchwork-Id: 106102 Message-Id: <1311265834-2144-5-git-send-email-zhroma@ispras.ru> To: gcc-patches@gcc.gnu.org Cc: dm@ispras.ru This patch moves the pass_sms before the pass_partition_blocks. There is no doloop_end pattern on x86_64. That's why current SMS implementation can't schedule any loops. But regtesting trunk with SMS on x86_64 shows an ICE on gcc.dg/tree-prof/bb-reorg.c. The problem is in an unconditional edge created by pass_partition_blocks. The edge is not eliminated while entering cfg_layout mode, and this leads to assertion fail, because there should be no unconditional jumps in cfg_layout mode. Moving the pass seems reasonable besause it also allows to prevent additional entering and exiting cfl_layout mode. I can't say anything about how correct such pass movement is from other points of view. 2011-07-20 Roman Zhuykov * modulo-sched.c (rest_of_handle_sms): Do not enter or exit cfg_layout mode. * passes.c (init_optimization_passes): Move pass_sms before pass_partition_blocks. --- gcc/modulo-sched.c | 9 --------- gcc/passes.c | 2 +- 2 files changed, 1 insertions(+), 10 deletions(-) diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c index 24d99af..948209e 100644 --- a/gcc/modulo-sched.c +++ b/gcc/modulo-sched.c @@ -3352,21 +3352,12 @@ static unsigned int rest_of_handle_sms (void) { #ifdef INSN_SCHEDULING - basic_block bb; - /* Collect loop information to be used in SMS. */ - cfg_layout_initialize (0); sms_schedule (); /* Update the life information, because we add pseudos. */ max_regno = max_reg_num (); - - /* Finalize layout changes. */ - FOR_EACH_BB (bb) - if (bb->next_bb != EXIT_BLOCK_PTR) - bb->aux = bb->next_bb; free_dominance_info (CDI_DOMINATORS); - cfg_layout_finalize (); #endif /* INSN_SCHEDULING */ return 0; } diff --git a/gcc/passes.c b/gcc/passes.c index 88b7147..5594571 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -1456,6 +1456,7 @@ init_optimization_passes (void) NEXT_PASS (pass_ud_rtl_dce); NEXT_PASS (pass_combine); NEXT_PASS (pass_if_after_combine); + NEXT_PASS (pass_sms); NEXT_PASS (pass_partition_blocks); NEXT_PASS (pass_regmove); NEXT_PASS (pass_outof_cfg_layout_mode); @@ -1465,7 +1466,6 @@ init_optimization_passes (void) NEXT_PASS (pass_stack_ptr_mod); NEXT_PASS (pass_mode_switching); NEXT_PASS (pass_match_asm_constraints); - NEXT_PASS (pass_sms); NEXT_PASS (pass_sched); NEXT_PASS (pass_ira); NEXT_PASS (pass_postreload);