aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-01-27 13:56:59 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-01-27 13:56:59 +0000
commit40b6bff965d004095b06ad3827e8221ae5bcc25e (patch)
tree6a577a4fc19836a6e400bff7742ec6ea1a480f79
parentb2f8892e35a0faa8a3c52da0eda13c12ddb76cc4 (diff)
downloadgcc-40b6bff965d004095b06ad3827e8221ae5bcc25e.zip
gcc-40b6bff965d004095b06ad3827e8221ae5bcc25e.tar.gz
gcc-40b6bff965d004095b06ad3827e8221ae5bcc25e.tar.bz2
re PR tree-optimization/79245 (Inefficient loop distribution to memcpy)
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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ldist-23.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ldist-25.c25
-rw-r--r--gcc/tree-loop-distribution.c3
5 files changed, 41 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a9f2421..3ed0564 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
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
* tree-vrp.c (register_new_assert_for): Revert earlier changes.
(compare_assert_loc): New function.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index aaa5972..5a68e58 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-23.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-23.c
index d58914e..74701b4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ldist-23.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-23.c
@@ -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
index 0000000..699bf38
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-25.c
@@ -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" } } */
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index a38cf7e..0fec1d6 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -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))
{