]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/115652 - more fixing of the fix
authorRichard Biener <rguenther@suse.de>
Fri, 28 Jun 2024 11:29:21 +0000 (13:29 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 28 Jun 2024 12:50:14 +0000 (14:50 +0200)
The following addresses the corner case of an outer loop with an empty
header where we end up asking for the BB of a NULL stmt by
special-casing this case.

PR tree-optimization/115652
* tree-vect-slp.cc (vect_schedule_slp_node): Handle the case
where the outer loop header block is empty.

gcc/tree-vect-slp.cc

index 174b4800fa9e36db1e96d182dd44e2afe86daa44..dd9017e5b3a2501753b9b29bab621421ed76f09c 100644 (file)
@@ -9750,8 +9750,15 @@ vect_schedule_slp_node (vec_info *vinfo,
              {
                gimple_stmt_iterator si2
                  = gsi_after_labels (LOOP_VINFO_LOOP (loop_vinfo)->header);
-               if (last_stmt != *si2
-                   && vect_stmt_dominates_stmt_p (last_stmt, *si2))
+               if ((gsi_end_p (si2)
+                    && (LOOP_VINFO_LOOP (loop_vinfo)->header
+                        != gimple_bb (last_stmt))
+                    && dominated_by_p (CDI_DOMINATORS,
+                                       LOOP_VINFO_LOOP (loop_vinfo)->header,
+                                       gimple_bb (last_stmt)))
+                   || (!gsi_end_p (si2)
+                       && last_stmt != *si2
+                       && vect_stmt_dominates_stmt_p (last_stmt, *si2)))
                  si = si2;
              }
        }