diff options
author | Richard Biener <rguenther@suse.de> | 2020-11-23 13:46:35 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-11-23 15:07:43 +0100 |
commit | 692d3b772755b798cc527a80ca2d02e23bc4e2bf (patch) | |
tree | c466a2faeb373b448d9ba6589660f774ce559bae | |
parent | 762ca20364a590be2cb9c79c0101ccbff74b5de1 (diff) | |
download | gcc-692d3b772755b798cc527a80ca2d02e23bc4e2bf.zip gcc-692d3b772755b798cc527a80ca2d02e23bc4e2bf.tar.gz gcc-692d3b772755b798cc527a80ca2d02e23bc4e2bf.tar.bz2 |
fix hybrid SLP discovery debug stmt issue
This properly skips debug USE_STMTs when looking for non-SLP sinks.
2020-11-23 Richard Biener <rguenther@suse.de>
* tree-vect-slp.c (maybe_push_to_hybrid_worklist): Skip
debug stmts.
* g++.dg/vect/simd-12.cc: New testcase.
-rw-r--r-- | gcc/testsuite/g++.dg/vect/simd-12.cc | 36 | ||||
-rw-r--r-- | gcc/tree-vect-slp.c | 2 |
2 files changed, 38 insertions, 0 deletions
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 0000000..a3f18d3 --- /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 <typename> class complex; +template <typename _Tp> complex<_Tp> operator+(complex<_Tp>, complex<_Tp> __y) { + complex<_Tp> __r; + __r += __y; + return __r; +} +template <typename _Tp> complex<_Tp> operator*(complex<_Tp>, complex<_Tp> __y) { + complex<_Tp> __r; + __r *= __y; + return __r; +} +template <> class complex<double> { +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 <typename> class Vector { + void equ(); + complex<double> *val; +}; +template <typename Number> void Vector<Number>::equ() { + Number c; + for (int i; i; ++i) { + complex<double> __trans_tmp_2 = c * val[i]; + val[i] = val[i] + __trans_tmp_2; + } +} +template class Vector<complex<double> >; diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 59a8630..da3ef43 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) |