]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/8988 (gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates code...
authorEric Botcazou <ebotcazou@libertysurf.fr>
Thu, 19 Dec 2002 20:27:56 +0000 (21:27 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Thu, 19 Dec 2002 20:27:56 +0000 (20:27 +0000)
PR optimization/8988
* loop.c (maybe_eliminate_biv): Kill REG_EQUAL notes mentioning
the biv when eliminating.

From-SVN: r60329

gcc/ChangeLog
gcc/loop.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/20021219-1.c [new file with mode: 0644]

index 49962b81341d287637c31ac78fa4537dd52a4795..a088ccf3d212586f229218f1a4ee6e603faf8ee4 100644 (file)
@@ -1,3 +1,9 @@
+2002-12-19  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       PR optimization/8988
+       * loop.c (maybe_eliminate_biv): Kill REG_EQUAL notes mentioning
+       the biv when eliminating.
+
 2002-12-17  Jakub Jelinek  <jakub@redhat.com>
 
        PR opt/8794
index ff598d323c49e627962f88fce2911acfccba105b..2dddc66e63ea39c7d4d026951f48856b047e0000 100644 (file)
@@ -8521,11 +8521,12 @@ maybe_eliminate_biv (loop, bl, eliminate_p, threshold, insn_count)
       enum rtx_code code = GET_CODE (p);
       basic_block where_bb = 0;
       rtx where_insn = threshold >= insn_count ? 0 : p;
+      rtx note;
 
       /* If this is a libcall that sets a giv, skip ahead to its end.  */
       if (GET_RTX_CLASS (code) == 'i')
        {
-         rtx note = find_reg_note (p, REG_LIBCALL, NULL_RTX);
+         note = find_reg_note (p, REG_LIBCALL, NULL_RTX);
 
          if (note)
            {
@@ -8543,6 +8544,8 @@ maybe_eliminate_biv (loop, bl, eliminate_p, threshold, insn_count)
                }
            }
        }
+
+      /* Closely examine the insn if the biv is mentioned.  */
       if ((code == INSN || code == JUMP_INSN || code == CALL_INSN)
          && reg_mentioned_p (reg, PATTERN (p))
          && ! maybe_eliminate_biv_1 (loop, PATTERN (p), p, bl,
@@ -8554,6 +8557,12 @@ maybe_eliminate_biv (loop, bl, eliminate_p, threshold, insn_count)
                     bl->regno, INSN_UID (p));
          break;
        }
+
+      /* If we are eliminating, kill REG_EQUAL notes mentioning the biv.  */
+      if (eliminate_p
+         && (note = find_reg_note (p, REG_EQUAL, NULL_RTX)) != NULL_RTX
+         && reg_mentioned_p (reg, XEXP (note, 0)))
+       remove_note (p, note);
     }
 
   if (p == loop->end)
index 735eb975d90061e91ad33088ccac337ffdc7cbd6..17e079d5e9b3caa7083088d5626e5a540ead9f59 100644 (file)
@@ -1,3 +1,7 @@
+2002-12-19  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * gcc.c-torture/execute/20021219-1.c: New test.
+
 2002-12-18  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        PR c++/8442
diff --git a/gcc/testsuite/gcc.c-torture/execute/20021219-1.c b/gcc/testsuite/gcc.c-torture/execute/20021219-1.c
new file mode 100644 (file)
index 0000000..2e658a5
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR optimization/8988 */
+/* Contributed by Kevin Easton */
+
+void foo(char *p1, char **p2)
+{}
+int main(void)
+{
+  char str[] = "foo { xx }";
+  char *ptr = str + 5;
+
+  foo(ptr, &ptr);
+
+  while (*ptr && (*ptr == 13 || *ptr == 32))
+    ptr++;
+
+  return 0;
+}