[llvm] [VPlan] Restrict addOperand to sub-classes that need it (NFC). (PR #200692)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 00:24:24 PDT 2026


================
@@ -1443,6 +1443,47 @@ bool VPInstruction::isSingleScalar() const {
   }
 }
 
+void VPInstruction::addOperand(VPValue *Op) {
+#ifndef NDEBUG
+  Type *Ty = Op->getScalarType();
+  switch (getOpcode()) {
+  case VPInstruction::AnyOf:
+  case VPInstruction::FirstActiveLane:
+  case VPInstruction::LastActiveLane:
+    assert(Ty == getOperand(0)->getScalarType() && Ty->isIntegerTy(1) &&
+           "appended operand must be an i1 (vector) matching operand 0");
----------------
lukel97 wrote:

Can we assert that `getOperand(0)->getScalarType()->isIntegerTy(1)` earlier in the VPInstruction constructor?

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


More information about the llvm-commits mailing list