[llvm] [SLP] NFC. Add assert for ShuffleCostEstimator and ShuffleInstructionBuilder usage. (PR #123708)
Han-Kuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 21 19:48:13 PST 2025
================
@@ -15229,6 +15235,9 @@ ResTy BoUpSLP::processBuildVector(const TreeEntry *E, Type *ScalarTy,
SmallVector<int> BVMask(GatheredScalars.size(), PoisonMaskElem);
TryPackScalars(GatheredScalars, BVMask, /*IsRootPoison=*/true);
Value *BV = ShuffleBuilder.gather(GatheredScalars, BVMask.size());
+ assert((BVMask.size() == E->Scalars.size() ||
+ BVMask.size() == E->ReuseShuffleIndices.size()) &&
+ "The mask is incompatible with the expected result.");
----------------
HanKuanChen wrote:
`BVMask` is initialized with `GatheredScalars.size()` and may be changed in `TryPackScalars` with `ReuseMask.assign(VF, PoisonMaskElem);`. The VF here is from `TreeEntry::getVectorFactor`.
`TryPackScalars` will make `GatheredScalars` to VF size. So the `BVMask.size()` is either `E->Scalars.size()` or `ReuseShuffleIndices.size()`.
https://github.com/llvm/llvm-project/pull/123708
More information about the llvm-commits
mailing list