[llvm] [SLP]Vectorize gathered loads (PR #107461)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 03:27:56 PDT 2024


================
@@ -6318,6 +6366,406 @@ void BoUpSLP::buildTree(ArrayRef<Value *> Roots) {
   buildTree_rec(Roots, 0, EdgeInfo());
 }
 
+/// Tries to find subvector of loads and builds new vector of only loads if can
+/// be profitable.
+static void gatherPossiblyVectorizableLoads(
+    const BoUpSLP &R, ArrayRef<Value *> VL, const DataLayout &DL,
+    ScalarEvolution &SE, const TargetTransformInfo &TTI,
+    SmallVectorImpl<SmallVector<std::pair<LoadInst *, int>>> &GatheredLoads,
+    bool AddNew = true) {
+  if (VL.empty())
+    return;
+  if (!isValidElementType(VL.front()->getType()))
+    return;
+  Type *ScalarTy = VL.front()->getType();
----------------
RKSimon wrote:

```
Type *ScalarTy = VL.front()->getType();
if (!isValidElementType(ScalarTy))
    return;
```

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


More information about the llvm-commits mailing list