* [PATCH] vect: Fix ICE in vectorizable_comparison PR93292
@ 2020-01-17 1:02 Jakub Jelinek
2020-01-17 7:56 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2020-01-17 1:02 UTC (permalink / raw)
To: Richard Biener, Richard Sandiford; +Cc: gcc-patches
Hi!
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.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
2020-01-16 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.
--- gcc/tree-vect-stmts.c.jj 2020-01-12 11:54:38.522381590 +0100
+++ gcc/tree-vect-stmts.c 2020-01-16 19:42:30.608888882 +0100
@@ -10492,7 +10492,7 @@ vectorizable_comparison (stmt_vec_info s
{
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)))
--- gcc/testsuite/g++.dg/opt/pr93292.C.jj 2020-01-16 19:48:51.110144613 +0100
+++ gcc/testsuite/g++.dg/opt/pr93292.C 2020-01-16 19:47:57.351956177 +0100
@@ -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);
+ }
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] vect: Fix ICE in vectorizable_comparison PR93292
2020-01-17 1:02 [PATCH] vect: Fix ICE in vectorizable_comparison PR93292 Jakub Jelinek
@ 2020-01-17 7:56 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2020-01-17 7:56 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Richard Sandiford, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1946 bytes --]
On Fri, 17 Jan 2020, Jakub Jelinek wrote:
> Hi!
>
> 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.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
OK.
Richard.
> 2020-01-16 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.
>
> --- gcc/tree-vect-stmts.c.jj 2020-01-12 11:54:38.522381590 +0100
> +++ gcc/tree-vect-stmts.c 2020-01-16 19:42:30.608888882 +0100
> @@ -10492,7 +10492,7 @@ vectorizable_comparison (stmt_vec_info s
> {
> 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)))
> --- gcc/testsuite/g++.dg/opt/pr93292.C.jj 2020-01-16 19:48:51.110144613 +0100
> +++ gcc/testsuite/g++.dg/opt/pr93292.C 2020-01-16 19:47:57.351956177 +0100
> @@ -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);
> + }
> +}
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-17 7:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-17 1:02 [PATCH] vect: Fix ICE in vectorizable_comparison PR93292 Jakub Jelinek
2020-01-17 7:56 ` 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).