[llvm] [SLP] Refine loop-aware gather cost and admit sibling-loop subtrees (PR #192801)

Ryan Buchner via llvm-commits llvm-commits at lists.llvm.org
Fri May 1 11:14:38 PDT 2026


================
@@ -12645,21 +12675,55 @@ void BoUpSLP::buildTreeRec(ArrayRef<Value *> VLRef, unsigned Depth,
                  S.getMainOp()->getParent()) {
     BasicBlock *Parent = S.getMainOp()->getParent();
     if (const Loop *L = LI->getLoopFor(Parent)) {
-      // Check that the new loop nest is not involved.
-      // Otherwise, mark it as a gather node.
+      // Check that the new loop nest shares the same outer structure as the
+      // tree's current loop nest. Completely disjoint nests (different
+      // outermost loops) are forced to gather because their scales cannot be
+      // meaningfully combined. Sibling inner loops inside a common outer
----------------
bababuck wrote:

Comment needs updated.

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


More information about the llvm-commits mailing list