diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-01-17 09:39:45 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-01-17 09:39:45 +0100 |
commit | dc9ba9d045d0cfc06207806fd64b06ab3304b196 (patch) | |
tree | 9ec208f5745572a28fd4923bca5e820abf50994d /gcc | |
parent | 40111910b0aa897b3e4c8d60c0c263e5c1a50446 (diff) | |
download | gcc-dc9ba9d045d0cfc06207806fd64b06ab3304b196.zip gcc-dc9ba9d045d0cfc06207806fd64b06ab3304b196.tar.gz gcc-dc9ba9d045d0cfc06207806fd64b06ab3304b196.tar.bz2 |
vect: Fix ICE in vectorizable_comparison PR93292
The following testcase ICEs on powerpc64le-linux. The problem is that
get_vectype_for_scalar_type returns NULL, and while most places in
tree-vect-stmts.c handle that case, this spot doesn't and punts only
if it is non-NULL, but with different number of elts than expected.
2020-01-17 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/93292
* tree-vect-stmts.c (vectorizable_comparison): Punt also if
get_vectype_for_scalar_type returns NULL.
* g++.dg/opt/pr93292.C: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/pr93292.C | 18 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.c | 2 |
4 files changed, 28 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e364f61..d8c34b2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-01-17 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/93292 + * tree-vect-stmts.c (vectorizable_comparison): Punt also if + get_vectype_for_scalar_type returns NULL. + 2020-01-16 Jan Hubicka <hubicka@ucw.cz> * params.opt (-param=max-predicted-iterations): Increase range from 0. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eea3bd2..5bd1ab2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2020-01-17 Jakub Jelinek <jakub@redhat.com> + PR tree-optimization/93292 + * g++.dg/opt/pr93292.C: New test. + PR testsuite/93294 * lib/c-compat.exp (compat-use-alt-compiler): Handle -fdiagnostics-urls=never similarly to -fdiagnostics-color=never. diff --git a/gcc/testsuite/g++.dg/opt/pr93292.C b/gcc/testsuite/g++.dg/opt/pr93292.C new file mode 100644 index 0000000..a368319 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr93292.C @@ -0,0 +1,18 @@ +// PR tree-optimization/93292 +// { dg-do compile } +// { dg-options "-O3 -w" } + +struct A { + static int foo (float x) { static int b; b = x ? x + 0.5 : 0; return b; } +}; + +void +bar (int *d, float e) +{ + float g; + for (int h = 0; h < 64; h++) + { + d[h] += A::foo (g < 0 ? : g > 5 ? : g); + A::foo (e); + } +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index df2899b..2ca8e49 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -10492,7 +10492,7 @@ vectorizable_comparison (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, { vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (rhs1), slp_node); - if (maybe_ne (TYPE_VECTOR_SUBPARTS (vectype), nunits)) + if (!vectype || maybe_ne (TYPE_VECTOR_SUBPARTS (vectype), nunits)) return false; } else if (maybe_ne (nunits, TYPE_VECTOR_SUBPARTS (vectype))) |