]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/115652 - amend last fix
authorRichard Biener <rguenther@suse.de>
Wed, 26 Jun 2024 17:23:26 +0000 (19:23 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 27 Jun 2024 05:52:51 +0000 (07:52 +0200)
The previous fix breaks in the degenerate case when the discovered
last_stmt is equal to the first stmt in the block since then we
undo a required stmt advancement.

PR tree-optimization/115652
* tree-vect-slp.cc (vect_schedule_slp_node): Only insert
at the start of the block if that strictly dominates
the discovered dependent stmt.

gcc/tree-vect-slp.cc

index 1f5b3fccf41aa1efde0f91e1bb31dcfb39fc4038..1252b613125be86fdecf0344c4d9da9601684bee 100644 (file)
@@ -9747,7 +9747,8 @@ vect_schedule_slp_node (vec_info *vinfo,
              {
                gimple_stmt_iterator si2
                  = gsi_after_labels (LOOP_VINFO_LOOP (loop_vinfo)->header);
-               if (vect_stmt_dominates_stmt_p (last_stmt, *si2))
+               if (last_stmt != *si2
+                   && vect_stmt_dominates_stmt_p (last_stmt, *si2))
                  si = si2;
              }
        }