[llvm] [VectorCombine] isExtractExtractCheap - specify the extract/insert shuffle mask to improve shuffle costs (PR #114780)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 06:21:44 PST 2024


================
@@ -482,8 +484,16 @@ bool VectorCombine::isExtractExtractCheap(ExtractElementInst *Ext0,
     // ShufMask = { poison, poison, 0, poison }
     // TODO: The cost model has an option for a "broadcast" shuffle
     //       (splat-from-element-0), but no option for a more general splat.
-    NewCost +=
-        TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc, VecTy);
+    if (auto *FixedVecTy = dyn_cast<FixedVectorType>(VecTy)) {
+      SmallVector<int> ShuffleMask;
+      ShuffleMask.append(FixedVecTy->getNumElements(), PoisonMaskElem);
----------------
alexey-bataev wrote:

`SmallVector<int> ShuffleMask(FixedVecTy->getNumElements(), PoisonMaskElem);`

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


More information about the llvm-commits mailing list