* [Committed, PR69109] Don't allow latch with phi in try_transform_to_exit_first_loop_alt
@ 2016-01-11 10:07 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2016-01-11 10:07 UTC (permalink / raw)
To: gcc-patches, Richard Biener
[-- Attachment #1: Type: text/plain, Size: 594 bytes --]
Hi,
when compiling src/gcc/testsuite/gcc.dg/vect/unswitch-loops-pr26969.c
and src/gcc/testsuite/gcc.c-torture/compile/pr32399.c with -O2
-funswitch-loops -ftree-parallelize-loops=2 we run into two different ICEs.
In both cases, -funswitch-loops introduces a virtual memory phi in the
latch, and transform_to_exit_first_loop_alt assumes there are no phis in
the latch, and generates invalid ssa as a result.
The patch fixes the problem by testing for phis in the latch in
try_transform_to_exit_first_loop_alt.
Bootstrapped and reg-tested on x86_64.
Committed to trunk.
Thanks,
- Tom
[-- Attachment #2: 0001-Don-t-allow-latch-with-phi-in-try_transform_to_exit_first_loop_alt.patch --]
[-- Type: text/x-patch, Size: 1799 bytes --]
Don't allow latch with phi in try_transform_to_exit_first_loop_alt
2016-01-07 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/69109
* tree-parloops.c (try_transform_to_exit_first_loop_alt): Don't allow
latch with phi.
* gcc.dg/autopar/pr69109-2.c: New test.
* gcc.dg/autopar/pr69109.c: New test.
---
gcc/testsuite/gcc.dg/autopar/pr69109-2.c | 4 ++++
gcc/testsuite/gcc.dg/autopar/pr69109.c | 4 ++++
gcc/tree-parloops.c | 4 ++++
3 files changed, 12 insertions(+)
diff --git a/gcc/testsuite/gcc.dg/autopar/pr69109-2.c b/gcc/testsuite/gcc.dg/autopar/pr69109-2.c
new file mode 100644
index 0000000..0a3154b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/autopar/pr69109-2.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-parallelize-loops=2 -funswitch-loops" } */
+
+#include "../../gcc.c-torture/compile/pr32399.c"
diff --git a/gcc/testsuite/gcc.dg/autopar/pr69109.c b/gcc/testsuite/gcc.dg/autopar/pr69109.c
new file mode 100644
index 0000000..58f3a9f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/autopar/pr69109.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-parallelize-loops=2 -funswitch-loops" } */
+
+#include "../vect/unswitch-loops-pr26969.c"
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index d683704..5afaaf8 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -1769,6 +1769,10 @@ try_transform_to_exit_first_loop_alt (struct loop *loop,
if (!gimple_seq_nondebug_singleton_p (bb_seq (loop->latch)))
return false;
+ /* Check whether the latch contains no phis. */
+ if (phi_nodes (loop->latch) != NULL)
+ return false;
+
/* Check whether the latch contains the loop iv increment. */
edge back = single_succ_edge (loop->latch);
edge exit = single_dom_exit (loop);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-01-11 10:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-11 10:07 [Committed, PR69109] Don't allow latch with phi in try_transform_to_exit_first_loop_alt Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).