[llvm] [SLP]Initial support for (masked)loads + compress and (masked)interleaved (PR #132099)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 21 04:46:57 PDT 2025


================
@@ -16867,6 +17118,40 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
       Value *PO = LI->getPointerOperand();
       if (E->State == TreeEntry::Vectorize) {
         NewLI = Builder.CreateAlignedLoad(VecTy, PO, LI->getAlign());
+      } else if (E->State == TreeEntry::MaskedLoadCompressVectorize) {
+        SmallVector<Value *> PointerOps(E->Scalars.size());
+        for (auto [I, V] : enumerate(E->Scalars))
+          PointerOps[I] = cast<LoadInst>(V)->getPointerOperand();
+        bool IsMasked;
+        unsigned InterleaveFactor;
+        SmallVector<int> CompressMask;
+        VectorType *LoadVecTy;
+        [[maybe_unused]] bool IsVectorized = isMaskedLoadCompress(
+            E->Scalars, PointerOps, std::nullopt, *TTI, *DL, *SE, *AC, *DT,
+            *TLI, [](Value *) { return true; }, IsMasked, InterleaveFactor,
+            CompressMask, LoadVecTy);
+        assert(IsVectorized && "Expected to be vectorized");
+        Align CommonAlignment;
+        if (IsMasked)
----------------
RKSimon wrote:

Merge the 2 consecutive IsMerged if-else stages?

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


More information about the llvm-commits mailing list