Index: loop.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/loop.c,v retrieving revision 1.412 diff -c -p -d -r1.412 loop.c *** loop.c 19 Jul 2002 16:31:40 -0000 1.412 --- loop.c 19 Jul 2002 23:51:43 -0000 *************** strength_reduce (loop, flags) *** 5320,5326 **** collected. Always unroll loops that would be as small or smaller unrolled than when rolled. */ if ((flags & LOOP_UNROLL) ! || (!(flags & LOOP_FIRST_PASS) && loop_info->n_iterations > 0 && unrolled_insn_copies <= insn_count)) unroll_loop (loop, insn_count, 1); --- 5320,5326 ---- collected. Always unroll loops that would be as small or smaller unrolled than when rolled. */ if ((flags & LOOP_UNROLL) ! || ((flags & LOOP_AUTO_UNROLL) && loop_info->n_iterations > 0 && unrolled_insn_copies <= insn_count)) unroll_loop (loop, insn_count, 1); Index: loop.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/loop.h,v retrieving revision 1.61 diff -c -p -d -r1.61 loop.h *** loop.h 30 May 2002 20:55:11 -0000 1.61 --- loop.h 19 Jul 2002 23:51:43 -0000 *************** Software Foundation, 59 Temple Place - S *** 28,34 **** #define LOOP_UNROLL 1 #define LOOP_BCT 2 #define LOOP_PREFETCH 4 ! #define LOOP_FIRST_PASS 8 /* Get the loop info pointer of a loop. */ #define LOOP_INFO(LOOP) ((struct loop_info *) (LOOP)->aux) --- 28,34 ---- #define LOOP_UNROLL 1 #define LOOP_BCT 2 #define LOOP_PREFETCH 4 ! #define LOOP_AUTO_UNROLL 8 /* Get the loop info pointer of a loop. */ #define LOOP_INFO(LOOP) ((struct loop_info *) (LOOP)->aux) Index: toplev.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/toplev.c,v retrieving revision 1.658 diff -c -p -d -r1.658 toplev.c *** toplev.c 17 Jul 2002 03:03:40 -0000 1.658 --- toplev.c 19 Jul 2002 23:51:43 -0000 *************** *** 1,4 **** - /* Top level of GNU C compiler Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. --- 1,3 ---- *************** rest_of_compilation (decl) *** 2878,2883 **** --- 2877,2884 ---- if (optimize > 0 && flag_loop_optimize) { + int do_unroll, do_prefetch; + timevar_push (TV_LOOP); delete_dead_jumptables (); cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP); *************** rest_of_compilation (decl) *** 2885,2896 **** /* CFG is no longer maintained up-to-date. */ free_bb_for_insn (); if (flag_rerun_loop_opt) { cleanup_barriers (); /* We only want to perform unrolling once. */ ! loop_optimize (insns, rtl_dump_file, LOOP_FIRST_PASS); /* The first call to loop_optimize makes some instructions trivially dead. We delete those instructions now in the --- 2886,2900 ---- /* CFG is no longer maintained up-to-date. */ free_bb_for_insn (); + do_unroll = flag_unroll_loops ? LOOP_UNROLL : LOOP_AUTO_UNROLL; + do_prefetch = flag_prefetch_loop_arrays ? LOOP_PREFETCH : 0; if (flag_rerun_loop_opt) { cleanup_barriers (); /* We only want to perform unrolling once. */ ! loop_optimize (insns, rtl_dump_file, do_unroll); ! do_unroll = 0; /* The first call to loop_optimize makes some instructions trivially dead. We delete those instructions now in the *************** rest_of_compilation (decl) *** 2903,2911 **** reg_scan (insns, max_reg_num (), 1); } cleanup_barriers (); ! loop_optimize (insns, rtl_dump_file, ! (flag_unroll_loops ? LOOP_UNROLL : 0) | LOOP_BCT ! | (flag_prefetch_loop_arrays ? LOOP_PREFETCH : 0)); /* Loop can create trivially dead instructions. */ delete_trivially_dead_insns (insns, max_reg_num ()); --- 2907,2913 ---- reg_scan (insns, max_reg_num (), 1); } cleanup_barriers (); ! loop_optimize (insns, rtl_dump_file, do_unroll | LOOP_BCT | do_prefetch); /* Loop can create trivially dead instructions. */ delete_trivially_dead_insns (insns, max_reg_num ());