loop.c (loop_optimize): Allocate loop_info structure for each loop prior to calling...
authorMichael Hayes <m.hayes@elec.canterbury.ac.nz>
Wed, 19 Jan 2000 20:10:00 +0000 (20:10 +0000)
committerMichael Hayes <m.hayes@gcc.gnu.org>
Wed, 19 Jan 2000 20:10:00 +0000 (20:10 +0000)
* loop.c (loop_optimize): Allocate loop_info structure for each loop
prior to calling scan_loop.

From-SVN: r31508

gcc/ChangeLog
gcc/loop.c

index 3ccbe76d42af5c5f4ab1ea89d93037c1a59de58f..fff7083ba9540175aa52a2e675c43add08e86aa1 100644 (file)
@@ -1,3 +1,8 @@
+2000-01-20  Michael Hayes  <m.hayes@elec.canterbury.ac.nz>
+
+       * loop.c (loop_optimize): Allocate loop_info structure for each loop
+       prior to calling scan_loop.
+
 Wed Jan 19 19:54:38 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
 
        * sh.c (prepare_scc_operands): Abort if no compare insn is available.
index d69094f5db8f8d0e35d70f02a08f027fb3119308..b52b33a55e5936fc1364eb0b9a19996fe45d8772 100644 (file)
@@ -510,15 +510,21 @@ loop_optimize (f, dumpfile, unroll_p, bct_p)
      this prevents low overhead loop instructions from being used.  */
   indirect_jump_in_function = indirect_jump_in_function_p (f);
 
-  /* Now scan the loops, last ones first, since this means inner ones are done
-     before outer ones.  */
+  /* Allocate and initialize auxiliary loop information.  */
   for (i = max_loop_num - 1; i >= 0; i--)
     {
       struct loop *loop = &loops->array[i];
 
       loop->info = (struct loop_info *) alloca (sizeof (struct loop_info));
       memset (loop->info, 0, sizeof (struct loop_info));
-      
+    }
+
+  /* Now scan the loops, last ones first, since this means inner ones are done
+     before outer ones.  */
+  for (i = max_loop_num - 1; i >= 0; i--)
+    {
+      struct loop *loop = &loops->array[i];
+
       if (! loop->invalid && loop->end)
        scan_loop (loop, unroll_p, bct_p);
     }