[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:23 PDT 2026


================
@@ -1908,11 +1907,25 @@ TEST_F(VPInstructionTest, VPSymbolicValueAddUserAfterMaterialization) {
   EXPECT_TRUE(Plan.getVF().isMaterialized());
 
   // Adding a new user to a materialized value should crash.
-  VPInstruction *I = new VPInstructionWithType(VPInstruction::StepVector, {},
-                                               IntegerType::get(C, 32));
-  VPBasicBlock &VPBB = *Plan.createVPBasicBlock("");
-  VPBB.appendRecipe(I);
-  EXPECT_DEATH(I->addOperand(VF), "accessing materialized symbolic value");
----------------
lukel97 wrote:

I guess we never validated `addOperands` against `VPInstruction::getNumOperandsForOpcode` beforehand?

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


More information about the llvm-commits mailing list