[llvm] [SLP]: Introduce and use getDataFlowCost (PR #112999)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 19 10:20:05 PDT 2024


================
@@ -10241,6 +10287,31 @@ InstructionCost BoUpSLP::getTreeCost(ArrayRef<Value *> VectorizedVals) {
 
     InstructionCost C = getEntryCost(&TE, VectorizedVals, CheckedExtracts);
     Cost += C;
+
+    // Calculate the cost difference of propagating a vector vs series of scalars
+    // across blocks. This may be nonzero in the case of illegal vectors.
+    Instruction *VL0 = TE.getMainOp();
+    bool IsAPhi = VL0 && isa<PHINode>(VL0);
+    bool HasNextEntry = VL0 && ((I + 1) < VectorizableTree.size());
----------------
alexey-bataev wrote:

Is this specific to PHI nodes only? Then it must be implemented in getEntryCost for case of PHI nodes

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


More information about the llvm-commits mailing list