]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/29984 (SPE GCC segfaults with MAX_EXPR <a, a>)
authorAndrew Pinski <pinskia@gmail.com>
Wed, 29 Nov 2006 07:23:11 +0000 (23:23 -0800)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Wed, 29 Nov 2006 07:23:11 +0000 (23:23 -0800)
2006-11-28  Andrew Pinski  <pinskia@gmail.com>

        PR tree-opt/29984
        * gcc.dg/tree-ssa/reassoc-12.c: New test.

2006-11-28  Andrew Pinski  <pinskia@gmail.com>

        PR tree-opt/29984
        * tree-ssa-reassoc.c (eliminate_duplicate_pair): Handle MAX_EXPR
        and MIN_EXRP.

From-SVN: r119303

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/reassoc-12.c [new file with mode: 0644]
gcc/tree-ssa-reassoc.c

index fb467916700b930724eab10ba0914c93bdd7af93..c838be7693a6488d92fc3d9a18d19d09804a7686 100644 (file)
@@ -1,3 +1,9 @@
+2006-11-28  Andrew Pinski  <pinskia@gmail.com>
+
+       PR tree-opt/29984
+       * tree-ssa-reassoc.c (eliminate_duplicate_pair): Handle MAX_EXPR
+       and MIN_EXRP.
+
 2006-11-28  Bob Wilson  <bob.wilson@acm.org>
 
        * config/xtensa/lib1funcs.asm (__umulsidi3): Restore a12-a15 on exit.
index 8d9d9e46091621a91875207d643f8568516938a8..a08b86a37bd9b23fa65a8f01ad525fa11a346110 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-28  Andrew Pinski  <pinskia@gmail.com>
+
+       PR tree-opt/29984
+       * gcc.dg/tree-ssa/reassoc-12.c: New test.
+
 2006-11-28  Jan Hubicka  <jh@suse.cz>
 
        * gcc.dg/memcpy-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-12.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-12.c
new file mode 100644 (file)
index 0000000..65e2931
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */ 
+/* { dg-options "-O2 -fdump-tree-reassoc1-details" } */
+int f(int a, int b)
+{
+  /* MAX_EXPR <a, a> should cause it to be equivalent to a.  */
+  int c = a>=b?a:b;
+  int d = c>=a?c:a;
+  return d;
+}
+/* { dg-final { scan-tree-dump-times "Equivalence:" 1 "reassoc1"} } */
+/* { dg-final { cleanup-tree-dump "reassoc1" } } */
index 6835a179125c143f8501428ec7f89d60c7cabf1a..8b5d34a0f309194cb8fc5e23af9a2f28588b6001 100644 (file)
@@ -417,8 +417,8 @@ eliminate_duplicate_pair (enum tree_code opcode,
                          operand_entry_t last)
 {
 
-  /* If we have two of the same op, and the opcode is & or |, we can
-     eliminate one of them.
+  /* If we have two of the same op, and the opcode is & |, min, or max,
+     we can eliminate one of them.
      If we have two of the same op, and the opcode is ^, we can
      eliminate both of them.  */
 
@@ -426,13 +426,15 @@ eliminate_duplicate_pair (enum tree_code opcode,
     {
       switch (opcode)
        {
+       case MAX_EXPR:
+       case MIN_EXPR:
        case BIT_IOR_EXPR:
        case BIT_AND_EXPR:
          if (dump_file && (dump_flags & TDF_DETAILS))
            {
              fprintf (dump_file, "Equivalence: ");
              print_generic_expr (dump_file, curr->op, 0);
-             fprintf (dump_file, " [&|] ");
+             fprintf (dump_file, " [&|minmax] ");
              print_generic_expr (dump_file, last->op, 0);
              fprintf (dump_file, " -> ");
              print_generic_stmt (dump_file, last->op, 0);