[llvm] [RISCV][TTI] Use processShuffleMask for shuffle legalization estimate (PR #136191)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 22 09:57:21 PDT 2025


================
@@ -383,6 +383,61 @@ static VectorType *getVRGatherIndexType(MVT DataVT, const RISCVSubtarget &ST,
   return cast<VectorType>(EVT(IndexVT).getTypeForEVT(C));
 }
 
+/// Attempt to approximate the cost of a shuffle which will require splitting
+/// during legalization.  Note that processShuffleMasks is not an exact proxy
+/// for the algorithm used in LegalizeVectorTypes, but hopefully it's a
+/// reasonably close upperbound.
+static InstructionCost costShuffleViaSplitting(RISCVTTIImpl &TTI, MVT LegalVT,
+                                               VectorType *Tp,
+                                               ArrayRef<int> Mask,
+                                               TTI::TargetCostKind CostKind) {
+  assert(LegalVT.isFixedLengthVector() && !Mask.empty() && "precondition");
----------------
alexey-bataev wrote:

"Expected fixed vector type and non-empty mask"?

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


More information about the llvm-commits mailing list