[llvm] [SLP]Improve/fix extracts calculations for non-power-of-2 elements. (PR #93213)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 10:29:58 PDT 2024


================
@@ -8281,19 +8299,18 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
             return Sz;
           return std::max(Sz, VecTy->getNumElements());
         });
-    unsigned NumSrcRegs =
-        TTI.getNumberOfParts(FixedVectorType::get(ScalarTy, NumElts));
-    if (NumSrcRegs == 0)
-      NumSrcRegs = 1;
     // FIXME: this must be moved to TTI for better estimation.
-    unsigned EltsPerVector = PowerOf2Ceil(std::max(
-        divideCeil(VL.size(), NumParts), divideCeil(NumElts, NumSrcRegs)));
+    unsigned EltsPerVector = getPartNumElems(VL.size(), NumParts);
     auto CheckPerRegistersShuffle =
-        [&](MutableArrayRef<int> Mask) -> std::optional<TTI::ShuffleKind> {
+        [&](MutableArrayRef<int> Mask,
+            SmallVector<int> Indices) -> std::optional<TTI::ShuffleKind> {
----------------
RKSimon wrote:

@alexey-bataev Should this be `SmallVector<int> &Indices` ? I noticed on #94546 that we never add the costs of TTI::SK_ExtractSubvector below

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


More information about the llvm-commits mailing list