[llvm] [SLP] NFC. Replace MainOp and AltOp in TreeEntry with InstructionsState. (PR #120198)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 06:39:29 PST 2025


================
@@ -3261,7 +3263,12 @@ class BoUpSLP {
     };
 
     /// Checks if the current node is a gather node.
-    bool isGather() const {return State == NeedToGather; }
+    bool isGather() const {
+      assert(
+          (State == NeedToGather || S.valid()) &&
+          "InstructionsState must be valid if the TreeEntry is not gathered.");
----------------
alexey-bataev wrote:

I understand what you are trying to do here, but we never do this in simple unrelated functions. This function shall check the state of the node, instead we check the state of the InstructionsState. Better to have this assertion in functions, directly related to InstructionsState, not here

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


More information about the llvm-commits mailing list