[llvm] [SLP]Exclude non-profitable subtrees. (PR #162018)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 28 06:22:24 PST 2025


================
@@ -8744,14 +8761,21 @@ void BoUpSLP::buildExternalUses(
 
         // Skip in-tree scalars that become vectors
         if (ArrayRef<TreeEntry *> UseEntries = getTreeEntries(U);
-            !UseEntries.empty()) {
+            !UseEntries.empty() &&
+            any_of(UseEntries, [this](const TreeEntry *UseEntry) {
+              return !DeletedNodes.contains(UseEntry) &&
+                     !TransformedToGatherNodes.contains(UseEntry);
+            })) {
           // Some in-tree scalars will remain as scalar in vectorized
           // instructions. If that is the case, the one in FoundLane will
           // be used.
           if (!((Scalar->getType()->getScalarType()->isPointerTy() &&
                  isa<LoadInst, StoreInst>(UserInst)) ||
                 isa<CallInst>(UserInst)) ||
----------------
alexey-bataev wrote:

No, they are parts of different sub-expressions

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


More information about the llvm-commits mailing list