[PATCH] Fix PR79887

Christophe Lyon christophe.lyon@linaro.org
Tue Mar 7 08:22:00 GMT 2017


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];
> +}
> +



More information about the Gcc-patches mailing list