]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/97043 - fix latent wrong-code with SLP vectorization
authorRichard Biener <rguenther@suse.de>
Mon, 14 Sep 2020 09:25:04 +0000 (11:25 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 14 Sep 2020 13:21:53 +0000 (15:21 +0200)
When the unrolling decision comes late and would have prevented
eliding a SLP load permutation we can end up generating aligned
loads when the load is in fact unaligned.  Most of the time
alignment analysis figures out the load is in fact unaligned
but that cannot be relied upon.

The following removes the SLP load permutation eliding based on
the still premature vectorization factor.

2020-09-14  Richard Biener  <rguenther@suse.de>

PR tree-optimization/97043
* tree-vect-slp.c (vect_analyze_slp_instance): Do not
elide a load permutation if the current vectorization
factor is one.

gcc/tree-vect-slp.c

index f6331eeea86e55ca591c873c6beb2ab7315c715c..3fdf56f9335f359925ad7b47e337072cb26c95ac 100644 (file)
@@ -2309,9 +2309,8 @@ vect_analyze_slp_instance (vec_info *vinfo,
                  /* The load requires permutation when unrolling exposes
                     a gap either because the group is larger than the SLP
                     group-size or because there is a gap between the groups.  */
-                 && (known_eq (unrolling_factor, 1U)
-                     || (group_size == DR_GROUP_SIZE (first_stmt_info)
-                         && DR_GROUP_GAP (first_stmt_info) == 0)))
+                 && group_size == DR_GROUP_SIZE (first_stmt_info)
+                 && DR_GROUP_GAP (first_stmt_info) == 0)
                {
                  SLP_TREE_LOAD_PERMUTATION (load_node).release ();
                  continue;