[llvm] [RISCV][TTI] Adjust VLS shuffle costing to account for sub-mask reuse (PR #129793)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 28 15:52:29 PDT 2025


================
@@ -430,11 +430,14 @@ costShuffleViaVRegSplitting(RISCVTTIImpl &TTI, MVT LegalVT,
   copy(Mask, NormalizedMask.begin());
   InstructionCost Cost = 0;
   int NumShuffles = 0;
+  DenseSet<std::pair<ArrayRef<int>, unsigned>> ReusedSingleSrcShuffles;
   processShuffleMasks(
       NormalizedMask, NumOfSrcRegs, NumOfDestRegs, NumOfDestRegs, []() {},
       [&](ArrayRef<int> RegMask, unsigned SrcReg, unsigned DestReg) {
         if (ShuffleVectorInst::isIdentityMask(RegMask, RegMask.size()))
           return;
+        if (!ReusedSingleSrcShuffles.insert(std::make_pair(RegMask, SrcReg)).second)
----------------
topperc wrote:

Please check that again

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


More information about the llvm-commits mailing list