[llvm] [SLP][REVEC] Support more mask pattern usage in shufflevector. (PR #106212)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 05:53:25 PDT 2024


================
@@ -10195,11 +10193,9 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
       return VecCost;
     };
     if (SLPReVec && !E->isAltShuffle())
-      return GetCostDiff(GetScalarCost, [](InstructionCost) {
-        // shufflevector will be eliminated by instcombine because the
-        // shufflevector masks are used in order (guaranteed by
-        // getShufflevectorNumGroups). The vector cost is 0.
-        return TTI::TCC_Free;
+      return GetCostDiff(GetScalarCost, [&](InstructionCost) {
+        return ::getShuffleCost(*TTI, TargetTransformInfo::SK_PermuteSingleSrc,
----------------
alexey-bataev wrote:

I would recommend checking if the mask created here is an identity mask and return cost Free if it is so explicitly.

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


More information about the llvm-commits mailing list