* regrename.c (build_def_use): Share RTL between MATCH_OPERATOR and
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 Mar 2002 07:45:30 +0000 (07:45 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 Mar 2002 07:45:30 +0000 (07:45 +0000)
corresponding MATCH_DUP.

* gcc.c-torture/compile/20020323-1.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51305 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/regrename.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20020323-1.c [new file with mode: 0644]

index e0b396c..9998544 100644 (file)
@@ -1,3 +1,8 @@
+2002-03-25  Jakub Jelinek  <jakub@redhat.com>
+
+       * regrename.c (build_def_use): Share RTL between MATCH_OPERATOR and
+       corresponding MATCH_DUP.
+
 2002-03-24  Richard Henderson  <rth@redhat.com>
 
        * unroll.c (unroll_loop): Zero label_map.
index 6277398..448eeb8 100644 (file)
@@ -764,7 +764,7 @@ build_def_use (bb)
          rtx note;
          rtx old_operands[MAX_RECOG_OPERANDS];
          rtx old_dups[MAX_DUP_OPERANDS];
-         int i;
+         int i, icode;
          int alt;
          int predicated;
 
@@ -786,6 +786,7 @@ build_def_use (bb)
 
          extract_insn (insn);
          constrain_operands (1);
+         icode = recog_memoized (insn);
          preprocess_constraints ();
          alt = which_alternative;
          n_ops = recog_data.n_operands;
@@ -827,8 +828,16 @@ build_def_use (bb)
            }
          for (i = 0; i < recog_data.n_dups; i++)
            {
+             int dup_num = recog_data.dup_num[i];
+
              old_dups[i] = *recog_data.dup_loc[i];
              *recog_data.dup_loc[i] = cc0_rtx;
+
+             /* For match_dup of match_operator or match_parallel, share
+                them, so that we don't miss changes in the dup.  */
+             if (icode >= 0
+                 && insn_data[icode].operand[dup_num].eliminable == 0)
+               old_dups[i] = recog_data.operand[dup_num];
            }
 
          scan_rtx (insn, &PATTERN (insn), NO_REGS, terminate_all_read,
index 528a2dc..0ec9af5 100644 (file)
@@ -1,3 +1,7 @@
+2002-03-25  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.c-torture/compile/20020323-1.c: New test.
+
 2002-03-24  Richard Henderson  <rth@redhat.com>
 
        * gcc.dg/weak-1.c: Use -fno-common.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20020323-1.c b/gcc/testsuite/gcc.c-torture/compile/20020323-1.c
new file mode 100644 (file)
index 0000000..ed3c666
--- /dev/null
@@ -0,0 +1,26 @@
+/* This testcase caused ICE on powerpc at -O3, because regrename did
+   not handle match_dup of match_operator if the RTLs were not shared.  */
+
+struct A
+{
+  unsigned char *a0, *a1;
+  int a2;
+};
+
+void bar (struct A *);
+
+unsigned int
+foo (int x)
+{
+  struct A a;
+  unsigned int b;
+
+  if (x < -128 || x > 255 || x == -1)
+    return 26;
+
+  a.a0 = (unsigned char *) &b;
+  a.a1 = a.a0 + sizeof (unsigned int);
+  a.a2 = 0;
+  bar (&a);
+  return b;
+}