]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/4311 (unrolling loops creates non-ending loop)
authorRichard Henderson <rth@redhat.com>
Wed, 3 Apr 2002 07:56:47 +0000 (23:56 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 3 Apr 2002 07:56:47 +0000 (23:56 -0800)
        PR opt/4311
        * loop.h (LOOP_FIRST_PASS): New.
        * loop.c (strength_reduce): Mind it when deciding to unroll.
        * toplev.c (rest_of_compilation): Set it.

From-SVN: r51798

gcc/ChangeLog
gcc/loop.c
gcc/loop.h
gcc/toplev.c

index d4522513a732e398b9ec470ec3c9172561306ace..5a4f4f324cdf6bbd35cfe1a82d2ad5e42af8f856 100644 (file)
@@ -1,3 +1,10 @@
+2002-04-02  Richard Henderson  <rth@redhat.com>
+
+       PR opt/4311
+       * loop.h (LOOP_FIRST_PASS): New.
+       * loop.c (strength_reduce): Mind it when deciding to unroll.
+       * toplev.c (rest_of_compilation): Set it.
+
 2002-04-02  David S. Miller  <davem@redhat.com>
 
        * config/sparc/sparc.md (ldd peephole2s): Fix final arg to
index 99281d0dba408e56702ede56edbf1b90a4fc34b0..b51b2a850d7e8703364066d6e8214786359a202b 100644 (file)
@@ -5214,7 +5214,8 @@ strength_reduce (loop, flags)
      collected.  Always unroll loops that would be as small or smaller
      unrolled than when rolled.  */
   if ((flags & LOOP_UNROLL)
-      || (loop_info->n_iterations > 0
+      || (!(flags & LOOP_FIRST_PASS)
+         && loop_info->n_iterations > 0
          && unrolled_insn_copies <= insn_count))
     unroll_loop (loop, insn_count, 1);
 
index 55f70ff63d9cf9abf7c7fc0a0c5cea1de10c656c..8e3a9351f36c7947d0ade34a3988ee08c06d5ca4 100644 (file)
@@ -28,6 +28,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #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)
index 24009593366b30c164b5e1002ca9d37c641ac55b..9fa22fc9cdfa5bb64b35dd70cad8ea7874d07342 100644 (file)
@@ -2805,8 +2805,7 @@ rest_of_compilation (decl)
          cleanup_barriers ();
 
          /* We only want to perform unrolling once.  */
-
-         loop_optimize (insns, rtl_dump_file, 0);
+         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