[llvm] [SLP] Better track MinBWs between vectorization attempts (PR #224199)

Ryan Buchner via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 10:48:47 PDT 2026


================
@@ -719,6 +719,32 @@ class slpvectorizer::BoUpSLP {
 
   unsigned getTreeSize() const { return VectorizableTree.size(); }
 
+  /// Returns the size of the current tree, stopping at gathers
+  /// For instance, even though we continue adding tree entries after
+  /// a split node, this function stops counting at the split node
+  /// since it is a gather. This matches the behavior of MinBWs
+  /// computation.
+  unsigned getTreeSizeExcludingGathers() const {
----------------
bababuck wrote:

I don't think it would be as accurate. Doing it based on tree size matches the behavior of `ComputeMinimumSizeValues` more closely, so we only re-calculate MinBWs when there is a chance of new smaller bit widths being discovered.

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


More information about the llvm-commits mailing list