[PATCH] tree-optimization/99807 - avoid bogus assert with permute SLP node
Richard Biener
rguenther@suse.de
Mon Mar 29 11:12:56 GMT 2021
This avoids asserting anything on the SLP_TREE_REPRESENTATIVE of
an SLP permute node (which shouldn't be there).
Bootstrapped / tested on x86_64-unknown-linux-gnu, pushed.
2021-03-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/99807
* tree-vect-slp.c (vect_slp_analyze_node_operations_1): Move
assert below VEC_PERM handling.
* gfortran.dg/vect/pr99807.f90: New testcase.
---
gcc/testsuite/gfortran.dg/vect/pr99807.f90 | 11 +++++++++++
gcc/tree-vect-slp.c | 2 +-
2 files changed, 12 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gfortran.dg/vect/pr99807.f90
diff --git a/gcc/testsuite/gfortran.dg/vect/pr99807.f90 b/gcc/testsuite/gfortran.dg/vect/pr99807.f90
new file mode 100644
index 00000000000..4ab46a32515
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr99807.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! { dg-additional-options "-march=armv8.3-a" { target aarch64-*-* } }
+
+subroutine cppco(ap, z)
+ implicit none
+ complex :: ap(*), z(*)
+
+ z(1) = z(1) + z(2) * (ap(1))
+
+ return
+end subroutine cppco
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index f1a2b5d60fa..ceec7f5c410 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -3724,7 +3724,6 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node,
stmt_vector_for_cost *cost_vec)
{
stmt_vec_info stmt_info = SLP_TREE_REPRESENTATIVE (node);
- gcc_assert (STMT_SLP_TYPE (stmt_info) != loop_vect);
/* Calculate the number of vector statements to be created for the
scalar stmts in this node. For SLP reductions it is equal to the
@@ -3760,6 +3759,7 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node,
if (SLP_TREE_CODE (node) == VEC_PERM_EXPR)
return vectorizable_slp_permutation (vinfo, NULL, node, cost_vec);
+ gcc_assert (STMT_SLP_TYPE (stmt_info) != loop_vect);
if (is_a <bb_vec_info> (vinfo)
&& !vect_update_shared_vectype (stmt_info, SLP_TREE_VECTYPE (node)))
{
--
2.26.2
More information about the Gcc-patches
mailing list