[llvm] [VectorCombine] Add a cost model for shuffleToIdentity. (PR #93937)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 3 07:15:17 PDT 2024
================
@@ -1878,6 +1893,31 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
if (NumVisited <= 1)
return false;
+ LLVM_DEBUG(dbgs() << "Found a set of shuffles that can be removed:\n");
+ InstructionCost OldShuffleCost;
+ for (auto *I : VisitedShuffles) {
+ InstructionCost C = TTI.getInstructionCost(I, TTI::TCK_RecipThroughput);
+ LLVM_DEBUG(dbgs() << C << *I << "\n");
+ OldShuffleCost += C;
+ }
+ LLVM_DEBUG(dbgs() << " total cost " << OldShuffleCost << "\n");
+ SmallVector<int, 16> ExtractMask(Ty->getNumElements());
+ std::iota(ExtractMask.begin(), ExtractMask.end(), 0);
----------------
davemgreen wrote:
I'm not sure what you mean. The iota fills it with an identity mask.
I've tried to rename the Mask name at least, that name was a copy-pasted from elsewhere.
https://github.com/llvm/llvm-project/pull/93937
More information about the llvm-commits
mailing list