public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-optimization/95335 - fix SLP nodes dropped to invariant
@ 2020-05-27 11:08 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2020-05-27 11:08 UTC (permalink / raw)
  To: gcc-patches

When we drop a SLP node to invariant because we cannot vectorize it
we have to make sure to revisit it in the users.

Bootstrapped / tested on x86_64-unknown-linux-gnu, applied.

2020-05-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/95335
	* tree-vect-slp.c (vect_slp_analyze_node_operations): Reset
	lvisited for nodes made external.

	* gcc.dg/vect/bb-slp-pr95335.c: New testcase.
---
 gcc/testsuite/gcc.dg/vect/bb-slp-pr95335.c | 13 +++++++++++++
 gcc/tree-vect-slp.c                        |  7 ++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.dg/vect/bb-slp-pr95335.c

diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr95335.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr95335.c
new file mode 100644
index 00000000000..42a70222e12
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr95335.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+float *a;
+float b;
+void
+fn1(float p1[][3])
+{
+  float c, d, e, f;
+  f = a[1] * a[1] * d;
+  b = a[1] * a[2] * d;
+  p1[1][1] = f + c;
+  p1[1][2] = b + e;
+}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index c0c9afd0bd2..a6c5a9d9dc4 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -2915,7 +2915,12 @@ vect_slp_analyze_node_operations (vec_info *vinfo, slp_tree node,
   /* If this node can't be vectorized, try pruning the tree here rather
      than felling the whole thing.  */
   if (!res && vect_slp_convert_to_external (vinfo, node, node_instance))
-    res = true;
+    {
+      /* We'll need to revisit this for invariant costing and number
+	 of vectorized stmt setting.   */
+      lvisited.remove (node);
+      res = true;
+    }
 
   return res;
 }
-- 
2.25.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-27 11:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 11:08 [PATCH] tree-optimization/95335 - fix SLP nodes dropped to invariant Richard Biener

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).