[llvm] [SLP] NFC. Use InstructionsState::valid if users just want to know whether VL has same opcode. (PR #120217)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 24 10:17:09 PST 2024


================
@@ -821,7 +821,8 @@ class InstructionsState {
 
   /// The main/alternate opcodes for the list of instructions.
   unsigned getOpcode() const {
-    return MainOp ? MainOp->getOpcode() : 0;
+    assert(MainOp && "InstructionsState is invalid.");
+    return MainOp->getOpcode();
   }
 
   unsigned getAltOpcode() const {
----------------
alexey-bataev wrote:

And in isAltShuffle too

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


More information about the llvm-commits mailing list