[llvm] [SLP]Represent SLP graph as a tree (PR #126771)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 20 04:48:48 PST 2025


================
@@ -5955,6 +5982,68 @@ static void combineOrders(MutableArrayRef<unsigned> Order,
   }
 }
 
+bool BoUpSLP::isProfitableToReorder() const {
+  constexpr unsigned TinyVF = 2;
+  constexpr unsigned TinyTree = 10;
+  if (VectorizableTree.size() <= TinyTree)
+    return true;
+  if (VectorizableTree.front()->hasState() &&
+      !VectorizableTree.front()->isGather() &&
+      (VectorizableTree.front()->getOpcode() == Instruction::Store ||
+       VectorizableTree.front()->getOpcode() == Instruction::PHI ||
+       (VectorizableTree.front()->getVectorFactor() <= TinyVF &&
+        (VectorizableTree.front()->getOpcode() == Instruction::PtrToInt ||
+         VectorizableTree.front()->getOpcode() == Instruction::ICmp))) &&
+      VectorizableTree.front()->ReorderIndices.empty()) {
+    constexpr unsigned PhiOpsLimit = 12;
+    constexpr unsigned GatherLoadsLimit = 2;
----------------
RKSimon wrote:

Hoist this to the top?

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


More information about the llvm-commits mailing list