public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] tree-optimization/107766 - ICE with recent -ffp-contract=off fix
Date: Tue, 22 Nov 2022 08:05:40 +0100 (CET)	[thread overview]
Message-ID: <20221122070540.F235B13AA1@imap2.suse-dmz.suse.de> (raw)

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.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

	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.
---
 gcc/testsuite/g++.dg/vect/pr107766.cc | 23 +++++++++++++++++++++++
 gcc/tree-vect-slp-patterns.cc         |  2 +-
 2 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/g++.dg/vect/pr107766.cc

diff --git a/gcc/testsuite/g++.dg/vect/pr107766.cc b/gcc/testsuite/g++.dg/vect/pr107766.cc
new file mode 100644
index 00000000000..744bcc900b0
--- /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 122d697a809..93735008bd1 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]);
-- 
2.35.3

                 reply	other threads:[~2022-11-22  7:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221122070540.F235B13AA1@imap2.suse-dmz.suse.de \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).