]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/95495 - use SLP_TREE_REPRESENTATIVE in assertion
authorRichard Biener <rguenther@suse.de>
Wed, 3 Jun 2020 12:06:20 +0000 (14:06 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 3 Jun 2020 14:51:05 +0000 (16:51 +0200)
This fixes a place where I missed to use SLP_TREE_REPRESENTATIVE
after its introduction.

2020-06-03  Richard Biener  <rguenther@suse.de>

PR tree-optimization/95495
* tree-vect-slp.c (vect_slp_analyze_node_operations): Use
SLP_TREE_REPRESENTATIVE in the shift assertion.

* gcc.dg/vect/pr95495.c: New testcase.

gcc/testsuite/gcc.dg/vect/pr95495.c [new file with mode: 0644]
gcc/tree-vect-slp.c

diff --git a/gcc/testsuite/gcc.dg/vect/pr95495.c b/gcc/testsuite/gcc.dg/vect/pr95495.c
new file mode 100644 (file)
index 0000000..a961aef
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+typedef struct {
+  int a;
+  int b;
+} c;
+int d, f, g;
+c e[4];
+void
+h()
+{
+  for (; f; f++) {
+    g += e[f].a >> 1 | e[f].a & 1;
+    d += e[f].b >> 1 | e[f].b & 1;
+  }
+}
index f1d61944ae0436372e1025bcd727362537769f79..cc33b64454c0be974e77017ff32588b4da56f7a4 100644 (file)
@@ -2888,7 +2888,7 @@ vect_slp_analyze_node_operations (vec_info *vinfo, slp_tree node,
              /* For shifts with a scalar argument we don't need
                 to cost or code-generate anything.
                 ???  Represent this more explicitely.  */
-             gcc_assert ((STMT_VINFO_TYPE (SLP_TREE_SCALAR_STMTS (node)[0])
+             gcc_assert ((STMT_VINFO_TYPE (SLP_TREE_REPRESENTATIVE (node))
                           == shift_vec_info_type)
                          && j == 1);
              continue;