* [PATCH] Fix PR79887
@ 2017-03-06 12:05 Richard Biener
2017-03-07 8:22 ` Christophe Lyon
0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2017-03-06 12:05 UTC (permalink / raw)
To: gcc-patches
This fixes a crash when we try to re-use a folded loop_vectorized_call
when vectorizing an epilogue.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
Richard.
2017-03-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/79894
* tree-vectorizer.c (vectorize_loops): Set loop_vectorized_call
to NULL after folding it.
* gcc.dg/vect/pr79887.c: New testcase.
Index: gcc/tree-vectorizer.c
===================================================================
--- gcc/tree-vectorizer.c (revision 245908)
+++ gcc/tree-vectorizer.c (working copy)
@@ -651,6 +651,7 @@ vectorize_loops (void)
"basic block vectorized\n");
fold_loop_vectorized_call (loop_vectorized_call,
boolean_true_node);
+ loop_vectorized_call = NULL;
ret |= TODO_cleanup_cfg;
}
}
@@ -703,6 +704,7 @@ vectorize_loops (void)
if (loop_vectorized_call)
{
fold_loop_vectorized_call (loop_vectorized_call, boolean_true_node);
+ loop_vectorized_call = NULL;
ret |= TODO_cleanup_cfg;
}
Index: gcc/testsuite/gcc.dg/vect/pr79887.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/pr79887.c (nonexistent)
+++ gcc/testsuite/gcc.dg/vect/pr79887.c (working copy)
@@ -0,0 +1,14 @@
+/* Test for pr79887. */
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_condition } */
+/* { dg-additional-options "-fno-trapping-math --param vect-epilogues-nomask=1" } */
+/* { dg-additional-options "-mavx512ifma" { target x86_64-*-* i?86-*-* } } */
+
+void
+foo (float a[32], float b[2][32])
+{
+ int i;
+ for (i = 0; i < 32; i++)
+ a[i] = (b[0][i] > b[1][i]) ? b[0][i] : b[1][i];
+}
+
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix PR79887
2017-03-06 12:05 [PATCH] Fix PR79887 Richard Biener
@ 2017-03-07 8:22 ` Christophe Lyon
2017-03-07 9:42 ` Richard Biener
0 siblings, 1 reply; 3+ messages in thread
From: Christophe Lyon @ 2017-03-07 8:22 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
Hi Richard,
On 6 March 2017 at 13:05, Richard Biener <rguenther@suse.de> wrote:
>
> This fixes a crash when we try to re-use a folded loop_vectorized_call
> when vectorizing an epilogue.
>
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
>
> Richard.
>
> 2017-03-06 Richard Biener <rguenther@suse.de>
>
> PR tree-optimization/79894
> * tree-vectorizer.c (vectorize_loops): Set loop_vectorized_call
> to NULL after folding it.
>
> * gcc.dg/vect/pr79887.c: New testcase.
>
The new testcase causes an ICE on arm-* targets.
The backtrace is as follows:
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/vect/pr79887.c:
In function 'foo':
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/vect/pr79887.c:8:1:
error: control flow in the middle of basic block 10
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/vect/pr79887.c:8:1:
error: wrong outgoing edge flags at end of bb 10
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/vect/pr79887.c:8:1:
internal compiler error: verify_flow_info failed
0x6b0205 verify_flow_info()
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/cfghooks.c:260
0xb9a794 checking_verify_flow_info
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/cfghooks.h:198
0xb9a794 cleanup_tree_cfg_noloop
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-cfgcleanup.c:774
0xb9a794 cleanup_tree_cfg()
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-cfgcleanup.c:820
0xa5af54 execute_function_todo
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/passes.c:1919
0xa5aca5 execute_todo
/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/passes.c:2016
Christophe
> Index: gcc/tree-vectorizer.c
> ===================================================================
> --- gcc/tree-vectorizer.c (revision 245908)
> +++ gcc/tree-vectorizer.c (working copy)
> @@ -651,6 +651,7 @@ vectorize_loops (void)
> "basic block vectorized\n");
> fold_loop_vectorized_call (loop_vectorized_call,
> boolean_true_node);
> + loop_vectorized_call = NULL;
> ret |= TODO_cleanup_cfg;
> }
> }
> @@ -703,6 +704,7 @@ vectorize_loops (void)
> if (loop_vectorized_call)
> {
> fold_loop_vectorized_call (loop_vectorized_call, boolean_true_node);
> + loop_vectorized_call = NULL;
> ret |= TODO_cleanup_cfg;
> }
>
> Index: gcc/testsuite/gcc.dg/vect/pr79887.c
> ===================================================================
> --- gcc/testsuite/gcc.dg/vect/pr79887.c (nonexistent)
> +++ gcc/testsuite/gcc.dg/vect/pr79887.c (working copy)
> @@ -0,0 +1,14 @@
> +/* Test for pr79887. */
> +/* { dg-do compile } */
> +/* { dg-require-effective-target vect_condition } */
> +/* { dg-additional-options "-fno-trapping-math --param vect-epilogues-nomask=1" } */
> +/* { dg-additional-options "-mavx512ifma" { target x86_64-*-* i?86-*-* } } */
> +
> +void
> +foo (float a[32], float b[2][32])
> +{
> + int i;
> + for (i = 0; i < 32; i++)
> + a[i] = (b[0][i] > b[1][i]) ? b[0][i] : b[1][i];
> +}
> +
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix PR79887
2017-03-07 8:22 ` Christophe Lyon
@ 2017-03-07 9:42 ` Richard Biener
0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2017-03-07 9:42 UTC (permalink / raw)
To: Christophe Lyon; +Cc: gcc-patches
On Tue, 7 Mar 2017, Christophe Lyon wrote:
> Hi Richard,
>
>
> On 6 March 2017 at 13:05, Richard Biener <rguenther@suse.de> wrote:
> >
> > This fixes a crash when we try to re-use a folded loop_vectorized_call
> > when vectorizing an epilogue.
> >
> > Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
> >
> > Richard.
> >
> > 2017-03-06 Richard Biener <rguenther@suse.de>
> >
> > PR tree-optimization/79894
> > * tree-vectorizer.c (vectorize_loops): Set loop_vectorized_call
> > to NULL after folding it.
> >
> > * gcc.dg/vect/pr79887.c: New testcase.
> >
>
> The new testcase causes an ICE on arm-* targets.
>
> The backtrace is as follows:
> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/vect/pr79887.c:
> In function 'foo':
> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/vect/pr79887.c:8:1:
> error: control flow in the middle of basic block 10
> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/vect/pr79887.c:8:1:
> error: wrong outgoing edge flags at end of bb 10
> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/testsuite/gcc.dg/vect/pr79887.c:8:1:
> internal compiler error: verify_flow_info failed
> 0x6b0205 verify_flow_info()
> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/cfghooks.c:260
> 0xb9a794 checking_verify_flow_info
> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/cfghooks.h:198
> 0xb9a794 cleanup_tree_cfg_noloop
> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-cfgcleanup.c:774
> 0xb9a794 cleanup_tree_cfg()
> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-cfgcleanup.c:820
> 0xa5af54 execute_function_todo
> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/passes.c:1919
> 0xa5aca5 execute_todo
> /aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/passes.c:2016
Thanks for reporting - prologue vectorization seems to hit a latent
bug where the vectorizer (rightfully) assumes pre-headers but does
not maintain them.
Bootstrap / regtest in progress on x86_64-unknown-linux-gnu.
Richard.
2017-03-07 Richard Biener <rguenther@suse.de>
* tree-vect-loop-manip.c (slpeel_add_loop_guard): Preserve
preheaders.
Index: gcc/tree-vect-loop-manip.c
===================================================================
--- gcc/tree-vect-loop-manip.c (revision 245947)
+++ gcc/tree-vect-loop-manip.c (working copy)
@@ -569,6 +569,11 @@ slpeel_add_loop_guard (basic_block guard
enter_e->count -= new_e->count;
enter_e->probability = inverse_probability (probability);
set_immediate_dominator (CDI_DOMINATORS, guard_to, dom_bb);
+
+ /* Split enter_e to preserve LOOPS_HAVE_PREHEADERS. */
+ if (enter_e->dest->loop_father->header == enter_e->dest)
+ split_edge (enter_e);
+
return new_e;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-07 9:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-06 12:05 [PATCH] Fix PR79887 Richard Biener
2017-03-07 8:22 ` Christophe Lyon
2017-03-07 9:42 ` Richard Biener
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).