X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Floop-unswitch.c;h=78da1154299ccf255e9ecad522d067cfc6860627;hp=b0e2aaa12be3feb4d1b28c0a52346d349f3a9a8c;hb=50010bbd08c1edce9d451c085ea7b26d06ed580c;hpb=7cef6c97cbe9575d82af3934ba9db98706d40dbd diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c index b0e2aaa12be..78da1154299 100644 --- a/gcc/loop-unswitch.c +++ b/gcc/loop-unswitch.c @@ -1,11 +1,12 @@ /* Loop unswitching for GNU compiler. - Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2012 + Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later +Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY @@ -14,9 +15,8 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301, USA. */ +along with GCC; see the file COPYING3. If not see +. */ #include "config.h" #include "system.h" @@ -110,6 +110,7 @@ compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp, rtx label, int prob, gcc_assert (rtx_equal_p (op1, XEXP (cond, 1))); emit_jump_insn (copy_insn (PATTERN (cinsn))); jump = get_last_insn (); + gcc_assert (JUMP_P (jump)); JUMP_LABEL (jump) = JUMP_LABEL (cinsn); LABEL_NUSES (JUMP_LABEL (jump))++; redirect_jump (jump, label, 0); @@ -121,13 +122,14 @@ compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp, rtx label, int prob, op0 = force_operand (op0, NULL_RTX); op1 = force_operand (op1, NULL_RTX); do_compare_rtx_and_jump (op0, op1, comp, 0, - mode, NULL_RTX, NULL_RTX, label); + mode, NULL_RTX, NULL_RTX, label, -1); jump = get_last_insn (); + gcc_assert (JUMP_P (jump)); JUMP_LABEL (jump) = label; LABEL_NUSES (label)++; } - REG_NOTES (jump) = gen_rtx_EXPR_LIST (REG_BR_PROB, GEN_INT (prob), - REG_NOTES (jump)); + add_reg_note (jump, REG_BR_PROB, GEN_INT (prob)); + seq = get_insns (); end_sequence (); @@ -143,7 +145,7 @@ unswitch_loops (void) /* Go through inner loops (only original ones). */ - FOR_EACH_LOOP (li, loop, LI_ONLY_OLD | LI_ONLY_INNERMOST) + FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST) { unswitch_single_loop (loop, NULL_RTX, 0); #ifdef ENABLE_CHECKING @@ -291,7 +293,7 @@ unswitch_single_loop (struct loop *loop, rtx cond_checked, int num) } /* Do not unswitch in cold areas. */ - if (!maybe_hot_bb_p (loop->header)) + if (optimize_loop_for_size_p (loop)) { if (dump_file) fprintf (dump_file, ";; Not unswitching, not hot area\n"); @@ -365,7 +367,7 @@ unswitch_single_loop (struct loop *loop, rtx cond_checked, int num) fprintf (dump_file, ";; Unswitching loop\n"); /* Unswitch the loop on this condition. */ - nloop = unswitch_loop (loop, bbs[i], cond, cinsn); + nloop = unswitch_loop (loop, bbs[i], copy_rtx_if_shared (cond), cinsn); gcc_assert (nloop); /* Invoke itself on modified loops. */ @@ -392,7 +394,6 @@ unswitch_loop (struct loop *loop, basic_block unswitch_on, rtx cond, rtx cinsn) edge entry, latch_edge, true_edge, false_edge, e; basic_block switch_bb, unswitch_on_alt; struct loop *nloop; - sbitmap zero_bitmap; int irred_flag, prob; rtx seq; @@ -409,7 +410,6 @@ unswitch_loop (struct loop *loop, basic_block unswitch_on, rtx cond, rtx cinsn) /* Make a copy. */ irred_flag = entry->flags & EDGE_IRREDUCIBLE_LOOP; entry->flags &= ~EDGE_IRREDUCIBLE_LOOP; - zero_bitmap = sbitmap_alloc (2); if (!duplicate_loop_to_header_edge (loop, entry, 1, NULL, NULL, NULL, 0)) return NULL; @@ -458,11 +458,6 @@ unswitch_loop (struct loop *loop, basic_block unswitch_on, rtx cond, rtx cinsn) remove_path (true_edge); remove_path (false_edge); - /* One of created loops do not have to be subloop of the outer loop now, - so fix its placement in loop data structure. */ - fix_loop_placement (loop); - fix_loop_placement (nloop); - /* Preserve the simple loop preheaders. */ split_edge (loop_preheader_edge (loop)); split_edge (loop_preheader_edge (nloop));