public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-4788] tree-optimization/111891 - fix assert in vectorizable_simd_clone_call
@ 2023-10-20 12:14 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-10-20 12:14 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:d70575f542f575133eb4c49eda89ab61eedf83b8
commit r14-4788-gd70575f542f575133eb4c49eda89ab61eedf83b8
Author: Richard Biener <rguenther@suse.de>
Date: Fri Oct 20 12:22:52 2023 +0200
tree-optimization/111891 - fix assert in vectorizable_simd_clone_call
The following fixes the assert in vectorizable_simd_clone_call to
assert we have a vector type during transform. Whether we have
one during analysis depends on whether another SLP user decided
on the type of a constant/external already. When we end up with
a mismatch in desire the updating will fail and make vectorization
fail.
PR tree-optimization/111891
* tree-vect-stmts.cc (vectorizable_simd_clone_call): Fix
assert.
* gfortran.dg/pr111891.f90: New testcase.
Diff:
---
gcc/testsuite/gfortran.dg/pr111891.f90 | 21 +++++++++++++++++++++
gcc/tree-vect-stmts.cc | 8 +++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/gcc/testsuite/gfortran.dg/pr111891.f90 b/gcc/testsuite/gfortran.dg/pr111891.f90
new file mode 100644
index 000000000000..1167ed60f4cb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr111891.f90
@@ -0,0 +1,21 @@
+! { dg-do compile }
+! { dg-options "-O2" }
+! { dg-additional-options "-mavx" { target avx } }
+
+!GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64')
+
+PARAMETER (NX=3, G=1.4)
+DIMENSION T(NX,NX), P(NX,NX)
+INTEGER Apx
+COMMON P, T
+
+DO i = 1, 3
+ IF (i < 0.0 ) THEN
+ P(Apx,i) = i**G
+ T(Apx,i) = i**G
+ ELSE
+ P(Apx,i) = 0
+ T(Apx,i) = 0
+ ENDIF
+ENDDO
+END
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 8d9028654c93..337b24c51f95 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -4070,7 +4070,13 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
if (thisarginfo.dt == vect_constant_def
|| thisarginfo.dt == vect_external_def)
{
- gcc_assert (vec_stmt || thisarginfo.vectype == NULL_TREE);
+ /* With SLP we determine the vector type of constants/externals
+ at analysis time, handling conflicts via
+ vect_maybe_update_slp_op_vectype. At transform time
+ we have a vector type recorded for SLP. */
+ gcc_assert (!vec_stmt
+ || !slp_node
+ || thisarginfo.vectype != NULL_TREE);
if (!vec_stmt)
thisarginfo.vectype = get_vectype_for_scalar_type (vinfo,
TREE_TYPE (op),
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-20 12:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20 12:14 [gcc r14-4788] tree-optimization/111891 - fix assert in vectorizable_simd_clone_call 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).