diff mbox

[PR81369/01] Sort partitions by post order for all cases

Message ID VI1PR0802MB2176981E51639B76489281C4E7AD0@VI1PR0802MB2176.eurprd08.prod.outlook.com
State New
Headers show

Commit Message

Bin Cheng July 14, 2017, 2:31 p.m. UTC
Hi,
This patch fixes ICE reported by PR81369.  It simply sinks call to
sort_partitions_by_post_order so that it's executed for all cases.
This is necessary to schedule reduction partition as the last one.
Bootstrap and test on x86_64 and AArch64.  Is it OK?

Thanks,
bin
2017-07-12  Bin Cheng  <bin.cheng@arm.com>

	PR target/81369
	* tree-loop-distribution.c (merge_dep_scc_partitions): Sink call to
	function sort_partitions_by_post_order.

gcc/testsuite/ChangeLog
2017-07-12  Bin Cheng  <bin.cheng@arm.com>

	PR target/81369
	* gcc.dg/tree-ssa/pr81369.c: New.

Comments

Richard Biener July 17, 2017, 10:11 a.m. UTC | #1
On Fri, Jul 14, 2017 at 4:31 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
> Hi,
> This patch fixes ICE reported by PR81369.  It simply sinks call to
> sort_partitions_by_post_order so that it's executed for all cases.
> This is necessary to schedule reduction partition as the last one.
> Bootstrap and test on x86_64 and AArch64.  Is it OK?

Ok.

Richard.

> Thanks,
> bin
> 2017-07-12  Bin Cheng  <bin.cheng@arm.com>
>
>         PR target/81369
>         * tree-loop-distribution.c (merge_dep_scc_partitions): Sink call to
>         function sort_partitions_by_post_order.
>
> gcc/testsuite/ChangeLog
> 2017-07-12  Bin Cheng  <bin.cheng@arm.com>
>
>         PR target/81369
>         * gcc.dg/tree-ssa/pr81369.c: New.
diff mbox

Patch

From 685bab237e38544375dcc9a950ae2816b8e4385b Mon Sep 17 00:00:00 2001
From: Bin Cheng <binche01@e108451-lin.cambridge.arm.com>
Date: Wed, 12 Jul 2017 12:04:49 +0100
Subject: [PATCH 1/2] pr81369-1.txt

---
 gcc/testsuite/gcc.dg/tree-ssa/pr81369.c | 23 +++++++++++++++++++++++
 gcc/tree-loop-distribution.c            |  3 ++-
 2 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr81369.c

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81369.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81369.c
new file mode 100644
index 0000000..b40477b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81369.c
@@ -0,0 +1,23 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-loop-distribution" } */
+
+typedef __PTRDIFF_TYPE__ intptr_t;
+int wo;
+
+void
+sy (long int *as)
+{
+  for (;;)
+    {
+      *as = wo;
+      while (as < (long int *) (void *) 2)
+        {
+          int *y9;
+
+          if (wo != 0)
+            *y9 = (int) (intptr_t) &wo;
+          wo /= (wo != 0 && *y9 != 0);
+          ++as;
+        }
+    }
+}
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index be0a660..fe678a5 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -1997,8 +1997,9 @@  merge_dep_scc_partitions (struct graph *rdg,
 		data->partition = NULL;
 	      }
 	}
-      sort_partitions_by_post_order (pg, partitions);
     }
+
+  sort_partitions_by_post_order (pg, partitions);
   gcc_assert (partitions->length () == (unsigned)num_sccs);
   free_partition_graph_vdata (pg);
   free_graph (pg);
-- 
1.9.1