diff options
author | Richard Biener <rguenther@suse.de> | 2022-11-21 07:56:06 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-11-22 08:06:14 +0100 |
commit | 1a06ae6f2f4f292fd05a900bcf433cb4282da1e3 (patch) | |
tree | 2f6a9cc6b709270c776e89f7ff21c31f125b1093 /gcc | |
parent | d5fce9f6c15554a7d5bfbbcd1740200f1d32fa15 (diff) | |
download | gcc-1a06ae6f2f4f292fd05a900bcf433cb4282da1e3.zip gcc-1a06ae6f2f4f292fd05a900bcf433cb4282da1e3.tar.gz gcc-1a06ae6f2f4f292fd05a900bcf433cb4282da1e3.tar.bz2 |
tree-optimization/107766 - ICE with recent -ffp-contract=off fix
The following uses *node to check for FP types rather than the
child nodes which could be constant leafs and thus without a
vector type.
PR tree-optimization/107766
* tree-vect-slp-patterns.cc (complex_mul_pattern::matches):
Use *node to check for FP vector types.
* g++.dg/vect/pr107766.cc: New testcase.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/g++.dg/vect/pr107766.cc | 23 | ||||
-rw-r--r-- | gcc/tree-vect-slp-patterns.cc | 2 |
2 files changed, 24 insertions, 1 deletions
diff --git a/gcc/testsuite/g++.dg/vect/pr107766.cc b/gcc/testsuite/g++.dg/vect/pr107766.cc new file mode 100644 index 0000000..744bcc9 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr107766.cc @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-additional-options "-ffp-contract=off" } + +typedef double btScalar; +struct btVector3 { + operator btScalar *() const; +}; +double m_vec[2]; +struct btShapeMatrix { + double &operator[](int i) { return m_vec[i]; } +}; +btScalar shape_function___1pxt1pz, shape_function__fac; +struct btMiniSDF { + void shape_function_(btVector3 const &) const; +}; +void btMiniSDF::shape_function_(btVector3 const &xi) const { + btShapeMatrix res; + btScalar _1m3y = 1.0 - 3.0 * xi[1], _1p3y = 1.0 + 3.0 * xi[1], + fact1m3y = shape_function__fac * _1m3y, + fact1p3y = shape_function__fac * _1p3y; + res[22] = fact1m3y * shape_function___1pxt1pz; + res[23] = fact1p3y * shape_function___1pxt1pz; +} diff --git a/gcc/tree-vect-slp-patterns.cc b/gcc/tree-vect-slp-patterns.cc index 122d697..9373500 100644 --- a/gcc/tree-vect-slp-patterns.cc +++ b/gcc/tree-vect-slp-patterns.cc @@ -1039,7 +1039,7 @@ complex_mul_pattern::matches (complex_operation_t op, with -ffp-contract=fast. */ if (!mul0 && (flag_fp_contract_mode == FP_CONTRACT_FAST - || !FLOAT_TYPE_P (SLP_TREE_VECTYPE (l0node[0]))) + || !FLOAT_TYPE_P (SLP_TREE_VECTYPE (*node))) && vect_match_expression_p (l0node[0], PLUS_EXPR)) { auto vals = SLP_TREE_CHILDREN (l0node[0]); |