From dbe138906d1b7b102873c6e49e496eb5fbc916d2 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 2 Feb 2019 01:04:39 +0100 Subject: [PATCH] re PR middle-end/87887 (ICE in make_ssa_name_fn, at tree-ssanames.c:269) PR middle-end/87887 * config/i386/i386.c (ix86_simd_clone_compute_vecsize_and_simdlen): Punt with warning on aggregate return or argument types. Ignore type/mode checking for uniform arguments. * gcc.dg/gomp/pr87887-1.c: New test. * gcc.dg/gomp/pr87887-2.c: New test. From-SVN: r268466 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/i386.c | 11 ++++++++--- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/gomp/pr87887-1.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/gomp/pr87887-2.c | 25 +++++++++++++++++++++++++ 5 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/gomp/pr87887-1.c create mode 100644 gcc/testsuite/gcc.dg/gomp/pr87887-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fba9fcf350b..33d4ecf5108 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-02-02 Jakub Jelinek + + PR middle-end/87887 + * config/i386/i386.c (ix86_simd_clone_compute_vecsize_and_simdlen): + Punt with warning on aggregate return or argument types. Ignore + type/mode checking for uniform arguments. + 2019-02-01 Segher Boessenkool * combine.c (try_combine): Do not print "Can't combine" messages unless diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 4e67abe8764..789a53501ee 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -50433,7 +50433,9 @@ ix86_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node, case E_DFmode: /* case E_SCmode: */ /* case E_DCmode: */ - break; + if (!AGGREGATE_TYPE_P (ret_type)) + break; + /* FALLTHRU */ default: warning_at (DECL_SOURCE_LOCATION (node->decl), 0, "unsupported return type %qT for simd", ret_type); @@ -50444,7 +50446,6 @@ ix86_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node, int i; for (t = DECL_ARGUMENTS (node->decl), i = 0; t; t = DECL_CHAIN (t), i++) - /* FIXME: Shouldn't we allow such arguments if they are uniform? */ switch (TYPE_MODE (TREE_TYPE (t))) { case E_QImode: @@ -50455,8 +50456,12 @@ ix86_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node, case E_DFmode: /* case E_SCmode: */ /* case E_DCmode: */ - break; + if (!AGGREGATE_TYPE_P (TREE_TYPE (t))) + break; + /* FALLTHRU */ default: + if (clonei->args[i].arg_type == SIMD_CLONE_ARG_TYPE_UNIFORM) + break; warning_at (DECL_SOURCE_LOCATION (node->decl), 0, "unsupported argument type %qT for simd", TREE_TYPE (t)); return 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 02a4b857e0e..4687a662dfb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-02-02 Jakub Jelinek + + PR middle-end/87887 + * gcc.dg/gomp/pr87887-1.c: New test. + * gcc.dg/gomp/pr87887-2.c: New test. + 2019-02-01 Jakub Jelinek PR fortran/83246 diff --git a/gcc/testsuite/gcc.dg/gomp/pr87887-1.c b/gcc/testsuite/gcc.dg/gomp/pr87887-1.c new file mode 100644 index 00000000000..8b04ffd0809 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr87887-1.c @@ -0,0 +1,26 @@ +/* PR middle-end/87887 */ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-w" } */ + +struct S { int n; }; +#pragma omp declare simd +struct S +foo (int x) +{ + return (struct S) { x }; +} + +#pragma omp declare simd +int +bar (struct S x) +{ + return x.n; +} + +#pragma omp declare simd uniform (x) +int +baz (int w, struct S x, int y) +{ + return w + x.n + y; +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr87887-2.c b/gcc/testsuite/gcc.dg/gomp/pr87887-2.c new file mode 100644 index 00000000000..51b6c2ae99d --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr87887-2.c @@ -0,0 +1,25 @@ +/* PR middle-end/87887 */ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-require-effective-target vect_simd_clones } */ + +struct S { int n; }; +#pragma omp declare simd +struct S +foo (int x) /* { dg-warning "unsupported return type 'struct S' for simd" } */ +{ + return (struct S) { x }; +} + +#pragma omp declare simd +int +bar (struct S x) /* { dg-warning "unsupported argument type 'struct S' for simd" } */ +{ + return x.n; +} + +#pragma omp declare simd uniform (x) +int +baz (int w, struct S x, int y) +{ + return w + x.n + y; +} -- 2.30.2