re PR tree-optimization/79245 (Inefficient loop distribution to memcpy)
authorRichard Biener <rguenther@suse.de>
Fri, 27 Jan 2017 13:56:59 +0000 (13:56 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 27 Jan 2017 13:56:59 +0000 (13:56 +0000)
2017-01-27  Richard Biener  <rguenther@suse.de>

PR tree-optimization/79245
* tree-loop-distribution.c (distribute_loop): Apply cost
modeling also to detected patterns.

* gcc.dg/tree-ssa/ldist-23.c: XFAIL.
* gcc.dg/tree-ssa/ldist-25.c: New testcase.

From-SVN: r244976

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/ldist-23.c
gcc/testsuite/gcc.dg/tree-ssa/ldist-25.c [new file with mode: 0644]
gcc/tree-loop-distribution.c

index a9f2421636885af53697afc4f0b89005ae9520aa..3ed05643df37029562057c12147ff747481ce89f 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-27  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/79245
+       * tree-loop-distribution.c (distribute_loop): Apply cost
+       modeling also to detected patterns.
+
 2017-01-27  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/71433
index aaa5972f3bc6743fa913ca9ad0c9dca36f86f7f1..5a68e58f028cb44a7b11e565d646c57dd7c046c6 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-27  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/79245
+       * gcc.dg/tree-ssa/ldist-23.c: XFAIL.
+       * gcc.dg/tree-ssa/ldist-25.c: New testcase.
+
 2017-01-27  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/79199
index d58914eee1633cf4ca2d0bca0deed61c92fff0e9..74701b434d5c432b1208dac032f87256f9be445d 100644 (file)
@@ -29,5 +29,6 @@ int main()
   return 0;
 }
 
-/* { dg-final { scan-tree-dump "split to 1 loops and 1 library call" "ldist" } } */
-/* { dg-final { scan-tree-dump "generated memcpy" "ldist" } } */
+/* XFAILed due to the fix for PR79245.  */
+/* { dg-final { scan-tree-dump "split to 1 loops and 1 library call" "ldist" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump "generated memcpy" "ldist" { xfail *-*-* }  } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-25.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-25.c
new file mode 100644 (file)
index 0000000..699bf38
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -ftree-loop-distribute-patterns -fdump-tree-ldist-details" } */
+
+#define k 1335
+double a[k][k];
+double b[k][k];
+double c[k][k];
+
+int x;
+int y;
+
+void
+foo (void)
+{
+  for (int j = 0; j < x; j++)
+    {
+      for (int i = 0; i < y; i++)
+       {
+         c[j][i] = b[j][i] - a[j][i];
+         a[j][i] = b[j][i];
+       }
+    }
+}
+
+/* { dg-final { scan-tree-dump "Loop . is the same" "ldist" } } */
index a38cf7e752b05dc4ce16886c95f0eab5ed973b2c..0fec1d6121ce0c510ad959d61f1a1744527d7c6f 100644 (file)
@@ -1548,8 +1548,7 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts,
       for (int j = i + 1;
           partitions.iterate (j, &partition); ++j)
        {
-         if (!partition_builtin_p (partition)
-             && similar_memory_accesses (rdg, into, partition))
+         if (similar_memory_accesses (rdg, into, partition))
            {
              if (dump_file && (dump_flags & TDF_DETAILS))
                {