This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fx PR79245


The following fixes a reported slowdown in 171.swim due to "better"
loop distribution dependence analysis.  We really should apply
the (weak) costing model also to builtin partitions.

(and work on a better one so we can enable loop distribution by
default at -O3)

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

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.

Index: gcc/tree-loop-distribution.c
===================================================================
--- gcc/tree-loop-distribution.c	(revision 244963)
+++ gcc/tree-loop-distribution.c	(working copy)
@@ -1548,8 +1548,7 @@ distribute_loop (struct loop *loop, vec<
       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))
 		{
Index: gcc/testsuite/gcc.dg/tree-ssa/ldist-23.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ldist-23.c	(revision 244963)
+++ gcc/testsuite/gcc.dg/tree-ssa/ldist-23.c	(working copy)
@@ -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 *-*-* }  } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/ldist-25.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ldist-25.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/tree-ssa/ldist-25.c	(working copy)
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -ftree-loop-distribute-patterns -fdump-tree-ldist-details" } */
+
+#define k 128000
+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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]