From: Richard Biener Date: Mon, 23 Nov 2020 12:46:35 +0000 (+0100) Subject: fix hybrid SLP discovery debug stmt issue X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=692d3b772755b798cc527a80ca2d02e23bc4e2bf;p=gcc.git fix hybrid SLP discovery debug stmt issue This properly skips debug USE_STMTs when looking for non-SLP sinks. 2020-11-23 Richard Biener * tree-vect-slp.c (maybe_push_to_hybrid_worklist): Skip debug stmts. * g++.dg/vect/simd-12.cc: New testcase. --- diff --git a/gcc/testsuite/g++.dg/vect/simd-12.cc b/gcc/testsuite/g++.dg/vect/simd-12.cc new file mode 100644 index 00000000000..a3f18d385ef --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/simd-12.cc @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ffast-math -g" } */ + +template class complex; +template complex<_Tp> operator+(complex<_Tp>, complex<_Tp> __y) { + complex<_Tp> __r; + __r += __y; + return __r; +} +template complex<_Tp> operator*(complex<_Tp>, complex<_Tp> __y) { + complex<_Tp> __r; + __r *= __y; + return __r; +} +template <> class complex { +public: + void operator+=(complex __z) { _M_value += __z.__rep(); } + void operator*=(complex __z) { + _Complex __t = __z.__rep(); + _M_value *= __t; + } + _Complex __rep() { return _M_value; } + _Complex _M_value; +}; +template class Vector { + void equ(); + complex *val; +}; +template void Vector::equ() { + Number c; + for (int i; i; ++i) { + complex __trans_tmp_2 = c * val[i]; + val[i] = val[i] + __trans_tmp_2; + } +} +template class Vector >; diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 59a8630f74a..da3ef433161 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -3191,6 +3191,8 @@ maybe_push_to_hybrid_worklist (vec_info *vinfo, any_def = true; FOR_EACH_IMM_USE_FAST (use_p, iter2, DEF_FROM_PTR (def_p)) { + if (is_gimple_debug (USE_STMT (use_p))) + continue; stmt_vec_info use_info = vinfo->lookup_stmt (USE_STMT (use_p)); /* An out-of loop use means this is a loop_vect sink. */ if (!use_info)