[llvm] [SLP] Initial support for masked stores (PR #204893)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 26 14:48:09 PDT 2026
================
@@ -32891,6 +33086,28 @@ bool SLPVectorizerPass::vectorizeStoreChains(BoUpSLP &R) {
V2->getValueOperand()->getValueID();
};
+ // Returns true if any two stores in the group are at consecutive (stride-1)
+ // addresses. Masked stores are disabled for the entire base-object group when
+ // this is true - consecutive vectorization is always preferred.
+ auto HasConsecutiveStores = [&](ArrayRef<StoreInst *> SIs) {
+ if (SIs.size() < 2)
+ return false;
+ Type *Ty = SIs.front()->getValueOperand()->getType();
+ Value *Base = SIs.front()->getPointerOperand();
+ SmallVector<int64_t> Offsets;
+ Offsets.reserve(SIs.size());
+ for (StoreInst *SI : SIs) {
+ if (std::optional<int64_t> Off =
+ getPointersDiff(Ty, Base, Ty, SI->getPointerOperand(), *DL, *SE))
+ Offsets.push_back(*Off);
+ }
+ sort(Offsets);
----------------
alexey-bataev wrote:
Do not think it matters here much
https://github.com/llvm/llvm-project/pull/204893
More information about the llvm-commits
mailing list