tree-optimization/97496 - avoid SLP externs in patterns
authorRichard Biener <rguenther@suse.de>
Tue, 20 Oct 2020 06:14:54 +0000 (08:14 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 20 Oct 2020 07:03:02 +0000 (09:03 +0200)
I forgot to guard the promotion to external for the case where the
def is in a pattern.

2020-10-20  Richard Biener  <rguenther@suse.de>

PR tree-optimization/97496
* tree-vect-slp.c (vect_get_and_check_slp_defs): Guard extern
promotion with not in pattern.

* gcc.dg/vect/bb-slp-pr97496.c: New testcase.

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

diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97496.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97496.c
new file mode 100644 (file)
index 0000000..fa9e980
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+int a;
+int b[1024];
+void c(unsigned g) {
+  if (a) {
+    long e = g, d = e;
+    int f = 0;
+    for (; f < 4; f++) {
+      b[f] = d;
+      d >>= 8;
+    }
+  }
+}
index f36d8d1c6420aac5b6df56afadd604c4bee1a158..0c1447e7aa0d7984302c60e9df27a5fc8986157b 100644 (file)
@@ -582,7 +582,8 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
              continue;
            }
 
-         if (is_a <bb_vec_info> (vinfo))
+         if (is_a <bb_vec_info> (vinfo)
+             && !oprnd_info->any_pattern)
            {
              /* Now for commutative ops we should see whether we can
                 make the other operand matching.  */