[llvm] [SLP] Normalize debug messages for newTreeEntry. (PR #119514)

Alexander Kornienko via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 08:58:45 PST 2025


================
@@ -8417,13 +8418,14 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
       }
       // Insert new order with initial value 0, if it does not exist,
       // otherwise return the iterator to the existing one.
-      newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx,
-                   ReuseShuffleIndices, CurrentOrder);
+      TreeEntry *TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx,
+                                   ReuseShuffleIndices, CurrentOrder);
+      LLVM_DEBUG(dbgs() << "SLP: added a new TreeEntry "
+                           "(ExtractValueInst/ExtractElementInst).\n";
+                 TE->dump());
       // This is a special case, as it does not gather, but at the same time
       // we are not extending buildTree_rec() towards the operands.
-      ValueList Op0;
-      Op0.assign(VL.size(), VL0->getOperand(0));
-      VectorizableTree.back()->setOperand(0, Op0);
+      TE->setOperand(*this);
----------------
alexfh wrote:

I also confirmed that this particular snippet is responsible for the change in the slp-vectorizer output. I.e. undoing it fixes the problem:
```
8449c8449,8452
<       TE->setOperand(*this);
---
>       (void)TE;
>       ValueList Op0;
>       Op0.assign(VL.size(), VL0->getOperand(0));
>       VectorizableTree.back()->setOperand(0, Op0);
```

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


More information about the llvm-commits mailing list