[llvm] [SLP] Make getSameOpcode support interchangeable instructions. (PR #127450)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 20 11:37:54 PST 2025


================
@@ -8501,8 +8735,12 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
 
   BlockScheduling &BS = *BSRef;
 
+  SmallVector<Value *> MainOpIsTheFirst(UniqueValues);
+  auto MainOpIter = find(MainOpIsTheFirst, S.getMainOp());
+  std::rotate(MainOpIsTheFirst.begin(), MainOpIter, std::next(MainOpIter));
+
   std::optional<ScheduleData *> Bundle =
-      BS.tryScheduleBundle(UniqueValues, this, S);
+      BS.tryScheduleBundle(MainOpIsTheFirst, this, S);
----------------
alexey-bataev wrote:

Better to adjust cancelScheduling, the first item in the bundle is just a Bundle->FirstInBundle

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


More information about the llvm-commits mailing list