[llvm] [SLP]Support revectorization of the previously vectorized scalars (PR #133091)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 27 09:00:05 PDT 2025


================
@@ -4814,12 +4803,19 @@ class BoUpSLP {
         ProcessBundleMember(SD, nullptr);
       } else {
         ScheduleBundle &Bundle = *cast<ScheduleBundle>(Data);
-        for_each(Bundle.getBundle(), [](ScheduleData *SD) {
-          SD->setScheduled(/*Scheduled=*/true);
-        });
+        Bundle.setScheduled(/*Scheduled=*/true);
         LLVM_DEBUG(dbgs() << "SLP:   schedule " << Bundle << "\n");
-        for (ScheduleData *SD : Bundle.getBundle())
-          ProcessBundleMember(SD, &Bundle);
+        for (ScheduleData *SD : Bundle.getBundle()) {
+          if (ArrayRef<ScheduleBundle *> SDBundles =
+                  getScheduleBundles(SD->getInst());
+              !SDBundles.empty() &&
+              all_of(SDBundles, [&](const ScheduleBundle *SDBundle) {
+                return SDBundle->isScheduled();
+              })) {
+            SD->setScheduled(/*Scheduled=*/true);
+            ProcessBundleMember(SD, &Bundle);
+          }
----------------
alexey-bataev wrote:

The lambda is not very hard to read, it is pretty simple.
SD cannot get the list of bundles in its context, it will require extra parameters, which does not look simpler

https://github.com/llvm/llvm-project/pull/133091


More information about the llvm-commits mailing list