From patchwork Wed Dec 22 17:57:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [PR47036] sel-sched: don't attempt to move up unconditional jumps Date: Wed, 22 Dec 2010 07:57:23 -0000 From: Alexander Monakov X-Patchwork-Id: 76437 Message-Id: To: gcc-patches@gcc.gnu.org Cc: "Vladimir N. Makarov" Hi, This patch drops bits of support for moving up unconditional jumps. The rest of the scheduler does not handle it anyway, and most of the time dependencies would prohibit such motion (in the testcase it's possible because other insns are nops). I've verified that the patch does not affect code generation on several cc1 .i files at -O3 (targeting ia64). Bootstrapped on x86-64-linux, ia64-linux (testsuite running). OK for trunk? 2010-12-22 Alexander Monakov PR rtl-optimization/47036 * sel-sched-ir.c (fallthru_bb_of_jump): Remove special support for unconditional jumps. * sel-sched.c (moveup_expr): Ditto. testsuite: * g++.dg/opt/pr47036.C: New. diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index 468dfd7..de40ba0 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -4441,9 +4441,6 @@ fallthru_bb_of_jump (rtx jump) if (!JUMP_P (jump)) return NULL; - if (any_uncondjump_p (jump)) - return single_succ (BLOCK_FOR_INSN (jump)); - if (!any_condjump_p (jump)) return NULL; diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c index 3b5603c..b5c9e57 100644 --- a/gcc/sel-sched.c +++ b/gcc/sel-sched.c @@ -2171,10 +2171,8 @@ moveup_expr (expr_t expr, insn_t through_insn, bool inside_insn_group, || ! in_current_region_p (fallthru_bb)) return MOVEUP_EXPR_NULL; - /* And it should be mutually exclusive with through_insn, or - be an unconditional jump. */ - if (! any_uncondjump_p (insn) - && ! sched_insns_conditions_mutex_p (insn, through_insn) + /* And it should be mutually exclusive with through_insn. */ + if (! sched_insns_conditions_mutex_p (insn, through_insn) && ! DEBUG_INSN_P (through_insn)) return MOVEUP_EXPR_NULL; } diff --git a/gcc/testsuite/g++.dg/opt/pr47036.C b/gcc/testsuite/g++.dg/opt/pr47036.C index e69de29..d6d5adc 100644 --- a/gcc/testsuite/g++.dg/opt/pr47036.C +++ b/gcc/testsuite/g++.dg/opt/pr47036.C @@ -0,0 +1,10 @@ +// { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } +// { dg-options "-fschedule-insns -fselective-scheduling -fno-dce" } + + +void foo () +{ + for (;;) + for (;;({break;})); +} +