From: Richard Biener Date: Tue, 20 Oct 2020 06:14:54 +0000 (+0200) Subject: tree-optimization/97496 - avoid SLP externs in patterns X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a335f6f4ee5cb4f7dbfef52e17bf854ae42c1216;p=gcc.git tree-optimization/97496 - avoid SLP externs in patterns I forgot to guard the promotion to external for the case where the def is in a pattern. 2020-10-20 Richard Biener 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. --- 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 index 00000000000..fa9e9801583 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97496.c @@ -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; + } + } +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index f36d8d1c642..0c1447e7aa0 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -582,7 +582,8 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap, continue; } - if (is_a (vinfo)) + if (is_a (vinfo) + && !oprnd_info->any_pattern) { /* Now for commutative ops we should see whether we can make the other operand matching. */