[llvm] [SLP] Simplify buildTree() and callees (NFC) (PR #135766)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 10:05:16 PDT 2025


=?utf-8?q?Ga=C3=ABtan?= Bossu <gaetan.bossu at arm.com>,
=?utf-8?q?Ga=C3=ABtan?= Bossu <gaetan.bossu at arm.com>,
=?utf-8?q?Ga=C3=ABtan?= Bossu <gaetan.bossu at arm.com>,
=?utf-8?q?Ga=C3=ABtan?= Bossu <gaetan.bossu at arm.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/135766 at github.com>


================
@@ -4251,13 +4260,34 @@ class BoUpSLP {
   bool areAltOperandsProfitable(const InstructionsState &S,
                                 ArrayRef<Value *> VL) const;
 
+  /// Contains all the outputs of legality analysis for a list of values to
+  /// vectorize.
+  class ScalarsVectorizationLegality {
+    InstructionsState S;
+    bool IsLegal;
+    bool TryToFindDuplicates;
+    bool TrySplitVectorize;
+
+  public:
+    ScalarsVectorizationLegality(InstructionsState S, bool IsLegal,
+                                 bool TryToFindDuplicates = true,
+                                 bool TrySplitVectorize = false)
+        : S(S), IsLegal(IsLegal), TryToFindDuplicates(TryToFindDuplicates),
+          TrySplitVectorize(TrySplitVectorize) {
+      assert((!IsLegal || (S.valid() && TryToFindDuplicates)) &&
+             "Inconsistent state");
+    }
+    const InstructionsState &getInstructionsState() const { return S; };
+    bool isLegal() const { return IsLegal; }
+    bool tryToFindDuplicates() const { return TryToFindDuplicates; }
+    bool trySplitVectorize() const { return TrySplitVectorize; }
+  };
+
----------------
alexey-bataev wrote:

Move to separate patch

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


More information about the llvm-commits mailing list