From: Richard Biener Date: Wed, 27 May 2020 09:18:01 +0000 (+0200) Subject: tree-optimization/95335 - fix SLP nodes dropped to invariant X-Git-Tag: upstream/12.2.0~16297 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a5d8d86e8a72736bfd8a2ce8aa427dec896a442e;p=platform%2Fupstream%2Fgcc.git tree-optimization/95335 - fix SLP nodes dropped to invariant When we drop a SLP node to invariant because we cannot vectorize it we have to make sure to revisit it in the users. 2020-05-27 Richard Biener 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. --- 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 0000000..42a7022 --- /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 c0c9afd..a6c5a9d 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; }