[llvm] [SLP] Compute a shuffle mask for SK_Broadcast shuffle (PR #85327)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 16:02:55 PDT 2024
================
@@ -7744,16 +7744,22 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
bool NeedShuffle =
count(VL, *It) > 1 &&
(VL.front() != *It || !all_of(VL.drop_front(), UndefValue::classof));
+ if (!NeedShuffle)
+ return TTI.getVectorInstrCost(Instruction::InsertElement, VecTy,
+ CostKind, std::distance(VL.begin(), It),
+ PoisonValue::get(VecTy), *It);
+
+ SmallVector<int> ShuffleMask(VL.size(), -1);
+ transform(VL, ShuffleMask.begin(), [](Value *V) {
+ return !isa<UndefValue>(V);
----------------
alexey-bataev wrote:
Filling int mask with bools?
```suggestion
return isa<PoisonValue>(V) ? PoisonMaskElem : 0;
```
https://github.com/llvm/llvm-project/pull/85327
More information about the llvm-commits
mailing list