]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/13985 (ICE in gcc.c-torture/compile/930621-1.c)
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 23 Apr 2004 22:01:35 +0000 (22:01 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 23 Apr 2004 22:01:35 +0000 (22:01 +0000)
PR optimization/13985
* cfgloopmanip.c (fix_loop_placements): New prototype.
Call fix_bb_placements on the preheader of loops that have
been reparented.
(remove_path): Adjust call to fix_loop_placements.

From-SVN: r81112

gcc/ChangeLog
gcc/cfgloopmanip.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/loop-3.c [new file with mode: 0644]

index 720bb0ad1f2a4a102191406e7fdef1b504ebd9fb..9c99787c34cd5d6d0283d2a1d6ee62d926970237 100644 (file)
@@ -1,3 +1,11 @@
+2004-04-23  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       PR optimization/13985
+       * cfgloopmanip.c (fix_loop_placements): New prototype.
+       Call fix_bb_placements on the preheader of loops that have
+       been reparented.
+       (remove_path): Adjust call to fix_loop_placements.
+
 2004-04-23  Andrew Pinski  <pinskia@physics.uc.edu>
 
        * config/darwin7.h: New file.
        to "Not triggered by any -O level" section.  Adjust commentary
        accordingly.
 
-2004-04-20  Anil Paranjpe   <anilp1@kpitcummins.com>
+2004-04-20  Anil Paranjpe <anilp1@kpitcummins.com>
 
        * toplev.c (compile_file): Move targetm.asm_out.file_end call to end.
 
index 59ae4a1ed7a2caaf56f77d9cbf54939749669cdf..e3807801d23eae6e3b0c2dd78d2039115925d7c2 100644 (file)
@@ -41,7 +41,7 @@ static bool rpe_enum_p (basic_block, void *);
 static int find_path (edge, basic_block **);
 static bool alp_enum_p (basic_block, void *);
 static void add_loop (struct loops *, struct loop *);
-static void fix_loop_placements (struct loop *);
+static void fix_loop_placements (struct loops *, struct loop *);
 static bool fix_bb_placement (struct loops *, basic_block);
 static void fix_bb_placements (struct loops *, basic_block);
 static void place_new_loop (struct loops *, struct loop *);
@@ -413,7 +413,7 @@ remove_path (struct loops *loops, edge e)
   /* Fix placements of basic blocks inside loops and the placement of
      loops in the loop tree.  */
   fix_bb_placements (loops, from);
-  fix_loop_placements (from->loop_father);
+  fix_loop_placements (loops, from->loop_father);
 
   return true;
 }
@@ -668,7 +668,7 @@ fix_loop_placement (struct loop *loop)
    It is used in case when we removed some edges coming out of LOOP, which
    may cause the right placement of LOOP inside loop tree to change.  */
 static void
-fix_loop_placements (struct loop *loop)
+fix_loop_placements (struct loops *loops, struct loop *loop)
 {
   struct loop *outer;
 
@@ -677,6 +677,13 @@ fix_loop_placements (struct loop *loop)
       outer = loop->outer;
       if (!fix_loop_placement (loop))
         break;
+
+      /* Changing the placement of a loop in the loop tree may alter the
+        validity of condition 2) of the description of fix_bb_placement
+        for its preheader, because the successor is the header and belongs
+        to the loop.  So call fix_bb_placements to fix up the placement
+        of the preheader and (possibly) of its predecessors.  */
+      fix_bb_placements (loops, loop_preheader_edge (loop)->src);
       loop = outer;
     }
 }
index f25bfd1b0c76b39c5b6dcc4380958cc3cc3f81fe..82a4936e89ecdb17cab3660f76bb77c1312d430d 100644 (file)
@@ -1,3 +1,7 @@
+2004-04-23  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * gcc.dg/loop-3.c: New test.
+
 2004-04-23  Daniel Jacobowitz  <drow@mvista.com>
 
        * gcc.c-torture/execute/simd-5.c: New test.
diff --git a/gcc/testsuite/gcc.dg/loop-3.c b/gcc/testsuite/gcc.dg/loop-3.c
new file mode 100644 (file)
index 0000000..ba6fe55
--- /dev/null
@@ -0,0 +1,45 @@
+/* PR optimization/13985 */
+/* Copied from gcc.c-torture/compile/930621-1.c */
+
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+/* { dg-options "-O3 -mtune=i386" { target i?86-*-* x86_64-*-* } } */
+
+#if defined(STACK_SIZE) && (STACK_SIZE < 65536)
+# define BYTEMEM_SIZE 10000L
+#endif
+
+#ifndef BYTEMEM_SIZE
+# define BYTEMEM_SIZE 45000L
+#endif
+
+int bytestart[5000 + 1];
+unsigned char modtext[400 + 1];
+unsigned char bytemem[2][BYTEMEM_SIZE + 1];
+
+long
+modlookup (int l)
+{
+  signed char c;
+  long j;
+  long k;
+  signed char w;
+  long p;
+  while (p != 0)
+    {
+      while ((k < bytestart[p + 2]) && (j <= l) && (modtext[j] == bytemem[w][k]))
+       {
+         k = k + 1;
+         j = j + 1;
+       }
+      if (k == bytestart[p + 2])
+       if (j > l)
+         c = 1;
+       else c = 4;
+      else if (j > l)
+       c = 3;
+      else if (modtext[j] < bytemem[w][k])
+       c = 0;
+      else c = 2;
+    }
+}