[llvm] 67c8e38 - [VPlan] Delegate to other VPInstruction constructors. (NFCI)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 16 14:21:16 PST 2025


Author: Florian Hahn
Date: 2025-11-16T22:21:00Z
New Revision: 67c8e38b8b439b44c2cd35f590c4897b928eb682

URL: https://github.com/llvm/llvm-project/commit/67c8e38b8b439b44c2cd35f590c4897b928eb682
DIFF: https://github.com/llvm/llvm-project/commit/67c8e38b8b439b44c2cd35f590c4897b928eb682.diff

LOG: [VPlan] Delegate to other VPInstruction constructors. (NFCI)

Update VPInstruction constructor to delegate to constructor with more
comprehensive checking and validation.

This required updating some unit tests, to make sure the constructed
VPInstructions are valid.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlan.h
    llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
    llvm/lib/Transforms/Vectorize/VPlanSLP.cpp
    llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
    llvm/unittests/Transforms/Vectorize/VPlanVerifierTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index ea88eaa42d945..754c6b50ae028 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1105,8 +1105,7 @@ class LLVM_ABI_FOR_TEST VPInstruction : public VPRecipeWithIRFlags,
 public:
   VPInstruction(unsigned Opcode, ArrayRef<VPValue *> Operands,
                 DebugLoc DL = DebugLoc::getUnknown(), const Twine &Name = "")
-      : VPRecipeWithIRFlags(VPDef::VPInstructionSC, Operands, DL),
-        VPIRMetadata(), Opcode(Opcode), Name(Name.str()) {}
+      : VPInstruction(Opcode, Operands, {}, {}, DL, Name) {}
 
   VPInstruction(unsigned Opcode, ArrayRef<VPValue *> Operands,
                 const VPIRFlags &Flags, const VPIRMetadata &MD = {},

diff  --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index aa85bd435ee9e..84bf0d525b86e 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -538,6 +538,7 @@ unsigned VPInstruction::getNumOperandsForOpcode(unsigned Opcode) {
   case Instruction::Load:
   case VPInstruction::AnyOf:
   case VPInstruction::BranchOnCond:
+  case VPInstruction::Broadcast:
   case VPInstruction::BuildStructVector:
   case VPInstruction::BuildVector:
   case VPInstruction::CalculateTripCountMinusVF:
@@ -548,13 +549,16 @@ unsigned VPInstruction::getNumOperandsForOpcode(unsigned Opcode) {
   case VPInstruction::ExtractPenultimateElement:
   case VPInstruction::FirstActiveLane:
   case VPInstruction::Not:
+  case VPInstruction::ResumeForEpilogue:
   case VPInstruction::Unpack:
     return 1;
   case Instruction::ICmp:
   case Instruction::FCmp:
+  case Instruction::ExtractElement:
   case Instruction::Store:
   case VPInstruction::BranchOnCount:
   case VPInstruction::ComputeReductionResult:
+  case VPInstruction::ExtractLane:
   case VPInstruction::FirstOrderRecurrenceSplice:
   case VPInstruction::LogicalAnd:
   case VPInstruction::PtrAdd:
@@ -572,6 +576,8 @@ unsigned VPInstruction::getNumOperandsForOpcode(unsigned Opcode) {
   case Instruction::GetElementPtr:
   case Instruction::PHI:
   case Instruction::Switch:
+  case VPInstruction::SLPLoad:
+  case VPInstruction::SLPStore:
     // Cannot determine the number of operands from the opcode.
     return -1u;
   }

diff  --git a/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp b/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp
index bab7a9e4205f7..1453c6623625b 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp
@@ -464,7 +464,8 @@ VPInstruction *VPlanSlp::buildGraph(ArrayRef<VPValue *> Values) {
         LLVM_DEBUG(dbgs() << "    Adding multinode Ops\n");
         // Create dummy VPInstruction, which will we replace later by the
         // re-ordered operand.
-        VPInstruction *Op = new VPInstruction(0, {});
+        VPInstruction *Op =
+            new VPInstruction(VPInstruction::Broadcast, {Values[0]});
         CombinedOperands.push_back(Op);
         MultiNodeOps.emplace_back(Op, Operands);
       }

diff  --git a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
index bb2991262a505..53a9f45fd5c3a 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
@@ -35,9 +35,9 @@ namespace {
 using VPInstructionTest = VPlanTestBase;
 
 TEST_F(VPInstructionTest, insertBefore) {
-  VPInstruction *I1 = new VPInstruction(0, {});
-  VPInstruction *I2 = new VPInstruction(1, {});
-  VPInstruction *I3 = new VPInstruction(2, {});
+  VPInstruction *I1 = new VPInstruction(VPInstruction::StepVector, {});
+  VPInstruction *I2 = new VPInstruction(VPInstruction::VScale, {});
+  VPInstruction *I3 = new VPInstruction(VPInstruction::StepVector, {});
 
   VPBasicBlock &VPBB1 = *getPlan().createVPBasicBlock("");
   VPBB1.appendRecipe(I1);
@@ -50,9 +50,9 @@ TEST_F(VPInstructionTest, insertBefore) {
 }
 
 TEST_F(VPInstructionTest, eraseFromParent) {
-  VPInstruction *I1 = new VPInstruction(0, {});
-  VPInstruction *I2 = new VPInstruction(1, {});
-  VPInstruction *I3 = new VPInstruction(2, {});
+  VPInstruction *I1 = new VPInstruction(VPInstruction::StepVector, {});
+  VPInstruction *I2 = new VPInstruction(VPInstruction::VScale, {});
+  VPInstruction *I3 = new VPInstruction(VPInstruction::StepVector, {});
 
   VPBasicBlock &VPBB1 = *getPlan().createVPBasicBlock("");
   VPBB1.appendRecipe(I1);
@@ -70,9 +70,9 @@ TEST_F(VPInstructionTest, eraseFromParent) {
 }
 
 TEST_F(VPInstructionTest, moveAfter) {
-  VPInstruction *I1 = new VPInstruction(0, {});
-  VPInstruction *I2 = new VPInstruction(1, {});
-  VPInstruction *I3 = new VPInstruction(2, {});
+  VPInstruction *I1 = new VPInstruction(VPInstruction::StepVector, {});
+  VPInstruction *I2 = new VPInstruction(VPInstruction::VScale, {});
+  VPInstruction *I3 = new VPInstruction(VPInstruction::StepVector, {});
 
   VPBasicBlock &VPBB1 = *getPlan().createVPBasicBlock("");
   VPBB1.appendRecipe(I1);
@@ -83,8 +83,8 @@ TEST_F(VPInstructionTest, moveAfter) {
 
   CHECK_ITERATOR(VPBB1, I2, I1, I3);
 
-  VPInstruction *I4 = new VPInstruction(4, {});
-  VPInstruction *I5 = new VPInstruction(5, {});
+  VPInstruction *I4 = new VPInstruction(VPInstruction::VScale, {});
+  VPInstruction *I5 = new VPInstruction(VPInstruction::StepVector, {});
   VPBasicBlock &VPBB2 = *getPlan().createVPBasicBlock("");
   VPBB2.appendRecipe(I4);
   VPBB2.appendRecipe(I5);
@@ -97,9 +97,9 @@ TEST_F(VPInstructionTest, moveAfter) {
 }
 
 TEST_F(VPInstructionTest, moveBefore) {
-  VPInstruction *I1 = new VPInstruction(0, {});
-  VPInstruction *I2 = new VPInstruction(1, {});
-  VPInstruction *I3 = new VPInstruction(2, {});
+  VPInstruction *I1 = new VPInstruction(VPInstruction::StepVector, {});
+  VPInstruction *I2 = new VPInstruction(VPInstruction::VScale, {});
+  VPInstruction *I3 = new VPInstruction(VPInstruction::StepVector, {});
 
   VPBasicBlock &VPBB1 = *getPlan().createVPBasicBlock("");
   VPBB1.appendRecipe(I1);
@@ -110,8 +110,8 @@ TEST_F(VPInstructionTest, moveBefore) {
 
   CHECK_ITERATOR(VPBB1, I2, I1, I3);
 
-  VPInstruction *I4 = new VPInstruction(4, {});
-  VPInstruction *I5 = new VPInstruction(5, {});
+  VPInstruction *I4 = new VPInstruction(VPInstruction::VScale, {});
+  VPInstruction *I5 = new VPInstruction(VPInstruction::StepVector, {});
   VPBasicBlock &VPBB2 = *getPlan().createVPBasicBlock("");
   VPBB2.appendRecipe(I4);
   VPBB2.appendRecipe(I5);
@@ -136,7 +136,7 @@ TEST_F(VPInstructionTest, setOperand) {
   IntegerType *Int32 = IntegerType::get(C, 32);
   VPValue *VPV1 = getPlan().getOrAddLiveIn(ConstantInt::get(Int32, 1));
   VPValue *VPV2 = getPlan().getOrAddLiveIn(ConstantInt::get(Int32, 2));
-  VPInstruction *I1 = new VPInstruction(0, {VPV1, VPV2});
+  VPInstruction *I1 = new VPInstruction(Instruction::Add, {VPV1, VPV2});
   EXPECT_EQ(1u, VPV1->getNumUsers());
   EXPECT_EQ(I1, *VPV1->user_begin());
   EXPECT_EQ(1u, VPV2->getNumUsers());
@@ -179,7 +179,7 @@ TEST_F(VPInstructionTest, replaceAllUsesWith) {
   IntegerType *Int32 = IntegerType::get(C, 32);
   VPValue *VPV1 = getPlan().getOrAddLiveIn(ConstantInt::get(Int32, 1));
   VPValue *VPV2 = getPlan().getOrAddLiveIn(ConstantInt::get(Int32, 2));
-  VPInstruction *I1 = new VPInstruction(0, {VPV1, VPV2});
+  VPInstruction *I1 = new VPInstruction(Instruction::Add, {VPV1, VPV2});
 
   // Replace all uses of VPV1 with VPV3.
   VPValue *VPV3 = getPlan().getOrAddLiveIn(ConstantInt::get(Int32, 3));
@@ -210,7 +210,7 @@ TEST_F(VPInstructionTest, replaceAllUsesWith) {
   EXPECT_EQ(0u, VPV2->getNumUsers());
   EXPECT_EQ(0u, VPV3->getNumUsers());
 
-  VPInstruction *I2 = new VPInstruction(0, {VPV1, VPV2});
+  VPInstruction *I2 = new VPInstruction(Instruction::Add, {VPV1, VPV2});
   EXPECT_EQ(3u, VPV1->getNumUsers());
   VPV1->replaceAllUsesWith(VPV3);
   EXPECT_EQ(3u, VPV3->getNumUsers());
@@ -223,7 +223,7 @@ TEST_F(VPInstructionTest, releaseOperandsAtDeletion) {
   IntegerType *Int32 = IntegerType::get(C, 32);
   VPValue *VPV1 = getPlan().getOrAddLiveIn(ConstantInt::get(Int32, 1));
   VPValue *VPV2 = getPlan().getOrAddLiveIn(ConstantInt::get(Int32, 1));
-  VPInstruction *I1 = new VPInstruction(0, {VPV1, VPV2});
+  VPInstruction *I1 = new VPInstruction(Instruction::Add, {VPV1, VPV2});
 
   EXPECT_EQ(1u, VPV1->getNumUsers());
   EXPECT_EQ(I1, *VPV1->user_begin());
@@ -706,7 +706,7 @@ TEST_F(VPBasicBlockTest, reassociateBlocks) {
 
 TEST_F(VPBasicBlockTest, splitAtEnd) {
   VPlan &Plan = getPlan();
-  VPInstruction *VPI = new VPInstruction(0, {});
+  VPInstruction *VPI = new VPInstruction(VPInstruction::StepVector, {});
   VPBasicBlock *VPBB = Plan.createVPBasicBlock("VPBB1", VPI);
   VPBlockUtils::connectBlocks(Plan.getEntry(), VPBB);
   VPBlockUtils::connectBlocks(VPBB, Plan.getScalarHeader());
@@ -727,7 +727,7 @@ TEST_F(VPBasicBlockTest, print) {
 
   VPInstruction *I1 = new VPInstruction(Instruction::Add, {Val, Val});
   VPInstruction *I2 = new VPInstruction(Instruction::Sub, {I1, Val});
-  VPInstruction *I3 = new VPInstruction(Instruction::Br, {I1, I2});
+  VPInstruction *I3 = new VPInstruction(Instruction::Store, {I1, I2});
 
   VPBasicBlock *VPBB1 = Plan.createVPBasicBlock("");
   VPBB1->appendRecipe(I1);
@@ -736,7 +736,7 @@ TEST_F(VPBasicBlockTest, print) {
   VPBB1->setName("bb1");
 
   VPInstruction *I4 = new VPInstruction(Instruction::Mul, {I2, I1});
-  VPInstruction *I5 = new VPInstruction(Instruction::Br, {I4});
+  VPInstruction *I5 = new VPInstruction(Instruction::Freeze, {I4});
   VPBasicBlock *VPBB2 = Plan.createVPBasicBlock("");
   VPBB2->appendRecipe(I4);
   VPBB2->appendRecipe(I5);
@@ -750,7 +750,7 @@ TEST_F(VPBasicBlockTest, print) {
     raw_string_ostream OS(I3Dump);
     VPSlotTracker SlotTracker;
     I3->print(OS, "", SlotTracker);
-    EXPECT_EQ("EMIT br <badref>, <badref>", I3Dump);
+    EXPECT_EQ("EMIT store <badref>, <badref>", I3Dump);
   }
 
   VPBlockUtils::connectBlocks(VPBB2, Plan.getScalarHeader());
@@ -773,14 +773,14 @@ compound=true
     "bb1:\l" +
     "  EMIT vp\<%1\> = add ir\<1\>, ir\<1\>\l" +
     "  EMIT vp\<%2\> = sub vp\<%1\>, ir\<1\>\l" +
-    "  EMIT br vp\<%1\>, vp\<%2\>\l" +
+    "  EMIT store vp\<%1\>, vp\<%2\>\l" +
     "Successor(s): bb2\l"
   ]
   N1 -> N2 [ label=""]
   N2 [label =
     "bb2:\l" +
     "  EMIT vp\<%4\> = mul vp\<%2\>, vp\<%1\>\l" +
-    "  EMIT br vp\<%4\>\l" +
+    "  EMIT vp\<%5\> = freeze vp\<%4\>\l" +
     "Successor(s): ir-bb\<scalar.header\>\l"
   ]
   N2 -> N3 [ label=""]
@@ -795,7 +795,7 @@ compound=true
   const char *ExpectedBlock1Str = R"(bb1:
   EMIT vp<%1> = add ir<1>, ir<1>
   EMIT vp<%2> = sub vp<%1>, ir<1>
-  EMIT br vp<%1>, vp<%2>
+  EMIT store vp<%1>, vp<%2>
 Successor(s): bb2
 )";
   std::string Block1Dump;
@@ -806,7 +806,7 @@ Successor(s): bb2
   // Ensure that numbering is good when dumping the second block in isolation.
   const char *ExpectedBlock2Str = R"(bb2:
   EMIT vp<%4> = mul vp<%2>, vp<%1>
-  EMIT br vp<%4>
+  EMIT vp<%5> = freeze vp<%4>
 Successor(s): ir-bb<scalar.header>
 )";
   std::string Block2Dump;
@@ -819,7 +819,7 @@ Successor(s): ir-bb<scalar.header>
     raw_string_ostream OS(I3Dump);
     VPSlotTracker SlotTracker(&Plan);
     I3->print(OS, "", SlotTracker);
-    EXPECT_EQ("EMIT br vp<%1>, vp<%2>", I3Dump);
+    EXPECT_EQ("EMIT store vp<%1>, vp<%2>", I3Dump);
   }
 
   {
@@ -832,9 +832,11 @@ Successor(s): ir-bb<scalar.header>
 
 TEST_F(VPBasicBlockTest, printPlanWithVFsAndUFs) {
   VPlan &Plan = getPlan();
+  IntegerType *Int32 = IntegerType::get(C, 32);
+  VPValue *Val = Plan.getOrAddLiveIn(ConstantInt::get(Int32, 1));
   VPBasicBlock *VPBB0 = Plan.getEntry();
 
-  VPInstruction *I1 = new VPInstruction(Instruction::Add, {});
+  VPInstruction *I1 = new VPInstruction(Instruction::Add, {Val, Val});
   VPBasicBlock *VPBB1 = Plan.createVPBasicBlock("");
   VPBB1->appendRecipe(I1);
   VPBB1->setName("bb1");
@@ -856,7 +858,7 @@ Live-in ir<1024> = original trip-count
 Successor(s): bb1
 
 bb1:
-  EMIT vp<%1> = add 
+  EMIT vp<%1> = add ir<1>, ir<1>
 Successor(s): ir-bb<scalar.header>
 
 ir-bb<scalar.header>:
@@ -879,7 +881,7 @@ Live-in ir<1024> = original trip-count
 Successor(s): bb1
 
 bb1:
-  EMIT vp<%1> = add 
+  EMIT vp<%1> = add ir<1>, ir<1>
 Successor(s): ir-bb<scalar.header>
 
 ir-bb<scalar.header>:
@@ -902,7 +904,7 @@ Live-in ir<1024> = original trip-count
 Successor(s): bb1
 
 bb1:
-  EMIT vp<%1> = add 
+  EMIT vp<%1> = add ir<1>, ir<1>
 Successor(s): ir-bb<scalar.header>
 
 ir-bb<scalar.header>:
@@ -1736,15 +1738,15 @@ TEST(VPDoubleValueDefTest, traverseUseLists) {
   // directions.
 
   // Create a new VPDef which defines 2 values and has 2 operands.
-  VPInstruction Op0(20, {});
-  VPInstruction Op1(30, {});
+  VPInstruction Op0(VPInstruction::StepVector, {});
+  VPInstruction Op1(VPInstruction::VScale, {});
   VPDoubleValueDef DoubleValueDef({&Op0, &Op1});
 
   // Create a new users of the defined values.
-  VPInstruction I1(
-      1, {DoubleValueDef.getVPValue(0), DoubleValueDef.getVPValue(1)});
-  VPInstruction I2(2, {DoubleValueDef.getVPValue(0)});
-  VPInstruction I3(3, {DoubleValueDef.getVPValue(1)});
+  VPInstruction I1(Instruction::Add, {DoubleValueDef.getVPValue(0),
+                                      DoubleValueDef.getVPValue(1)});
+  VPInstruction I2(Instruction::Freeze, {DoubleValueDef.getVPValue(0)});
+  VPInstruction I3(Instruction::Freeze, {DoubleValueDef.getVPValue(1)});
 
   // Check operands of the VPDef (traversing upwards).
   SmallVector<VPValue *, 4> DoubleOperands(DoubleValueDef.op_begin(),

diff  --git a/llvm/unittests/Transforms/Vectorize/VPlanVerifierTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanVerifierTest.cpp
index 169114ed6c310..1b0cd1074c1b5 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanVerifierTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanVerifierTest.cpp
@@ -22,8 +22,8 @@ namespace {
 TEST_F(VPVerifierTest, VPInstructionUseBeforeDefSameBB) {
   VPlan &Plan = getPlan();
   VPValue *Zero = Plan.getConstantInt(32, 0);
-  VPInstruction *DefI = new VPInstruction(Instruction::Add, {Zero});
-  VPInstruction *UseI = new VPInstruction(Instruction::Sub, {DefI});
+  VPInstruction *DefI = new VPInstruction(Instruction::Add, {Zero, Zero});
+  VPInstruction *UseI = new VPInstruction(Instruction::Sub, {DefI, Zero});
   auto *CanIV = new VPCanonicalIVPHIRecipe(Zero, {});
 
   VPBasicBlock *VPBB1 = Plan.getEntry();
@@ -43,9 +43,9 @@ TEST_F(VPVerifierTest, VPInstructionUseBeforeDefSameBB) {
 #if GTEST_HAS_STREAM_REDIRECTION
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   EXPECT_STREQ("Use before def!\n"
-               "  EMIT vp<%1> = sub vp<%2>\n"
+               "  EMIT vp<%1> = sub vp<%2>, ir<0>\n"
                "  before\n"
-               "  EMIT vp<%2> = add ir<0>\n",
+               "  EMIT vp<%2> = add ir<0>, ir<0>\n",
                ::testing::internal::GetCapturedStderr().c_str());
 #else
   EXPECT_STREQ("Use before def!\n",
@@ -57,8 +57,8 @@ TEST_F(VPVerifierTest, VPInstructionUseBeforeDefSameBB) {
 TEST_F(VPVerifierTest, VPInstructionUseBeforeDefDifferentBB) {
   VPlan &Plan = getPlan();
   VPValue *Zero = Plan.getConstantInt(32, 0);
-  VPInstruction *DefI = new VPInstruction(Instruction::Add, {Zero});
-  VPInstruction *UseI = new VPInstruction(Instruction::Sub, {DefI});
+  VPInstruction *DefI = new VPInstruction(Instruction::Add, {Zero, Zero});
+  VPInstruction *UseI = new VPInstruction(Instruction::Sub, {DefI, Zero});
   auto *CanIV = new VPCanonicalIVPHIRecipe(Zero, {});
   VPInstruction *BranchOnCond =
       new VPInstruction(VPInstruction::BranchOnCond, {CanIV});
@@ -82,9 +82,9 @@ TEST_F(VPVerifierTest, VPInstructionUseBeforeDefDifferentBB) {
 #if GTEST_HAS_STREAM_REDIRECTION
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   EXPECT_STREQ("Use before def!\n"
-               "  EMIT vp<%1> = sub vp<%3>\n"
+               "  EMIT vp<%1> = sub vp<%3>, ir<0>\n"
                "  before\n"
-               "  EMIT vp<%3> = add ir<0>\n",
+               "  EMIT vp<%3> = add ir<0>, ir<0>\n",
                ::testing::internal::GetCapturedStderr().c_str());
 #else
   EXPECT_STREQ("Use before def!\n",
@@ -99,7 +99,7 @@ TEST_F(VPVerifierTest, VPBlendUseBeforeDefDifferentBB) {
   auto *Phi = PHINode::Create(Int32, 1);
   VPValue *Zero = Plan.getOrAddLiveIn(ConstantInt::get(Int32, 0));
 
-  VPInstruction *DefI = new VPInstruction(Instruction::Add, {Zero});
+  VPInstruction *DefI = new VPInstruction(Instruction::Add, {Zero, Zero});
   auto *CanIV = new VPCanonicalIVPHIRecipe(Zero, {});
   VPInstruction *BranchOnCond =
       new VPInstruction(VPInstruction::BranchOnCond, {CanIV});
@@ -132,7 +132,7 @@ TEST_F(VPVerifierTest, VPBlendUseBeforeDefDifferentBB) {
   EXPECT_STREQ("Use before def!\n"
                "  BLEND ir<<badref>> = vp<%2>\n"
                "  before\n"
-               "  EMIT vp<%2> = add ir<0>\n",
+               "  EMIT vp<%2> = add ir<0>, ir<0>\n",
                ::testing::internal::GetCapturedStderr().c_str());
 #else
   EXPECT_STREQ("Use before def!\n",
@@ -153,7 +153,7 @@ TEST_F(VPVerifierTest, VPPhiIncomingValueDoesntDominateIncomingBlock) {
   VPBasicBlock *VPBB3 = Plan.createVPBasicBlock("");
   VPBasicBlock *VPBB4 = Plan.createVPBasicBlock("");
 
-  VPInstruction *DefI = new VPInstruction(Instruction::Add, {Zero});
+  VPInstruction *DefI = new VPInstruction(Instruction::Add, {Zero, Zero});
   VPPhi *Phi = new VPPhi({DefI}, {});
   VPBB2->appendRecipe(Phi);
   VPBB2->appendRecipe(DefI);
@@ -171,7 +171,7 @@ TEST_F(VPVerifierTest, VPPhiIncomingValueDoesntDominateIncomingBlock) {
 #if GTEST_HAS_STREAM_REDIRECTION
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   EXPECT_STREQ("Incoming def does not dominate incoming block!\n"
-               "  EMIT vp<%2> = add ir<0>\n"
+               "  EMIT vp<%2> = add ir<0>, ir<0>\n"
                "  does not dominate preheader for\n"
                "  EMIT-SCALAR vp<%1> = phi [ vp<%2>, preheader ]",
                ::testing::internal::GetCapturedStderr().c_str());
@@ -185,7 +185,7 @@ TEST_F(VPVerifierTest, VPPhiIncomingValueDoesntDominateIncomingBlock) {
 TEST_F(VPVerifierTest, DuplicateSuccessorsOutsideRegion) {
   VPlan &Plan = getPlan();
   VPValue *Zero = Plan.getConstantInt(32, 0);
-  VPInstruction *I1 = new VPInstruction(Instruction::Add, {Zero});
+  VPInstruction *I1 = new VPInstruction(Instruction::Add, {Zero, Zero});
   auto *CanIV = new VPCanonicalIVPHIRecipe(Zero, {});
   VPInstruction *BranchOnCond =
       new VPInstruction(VPInstruction::BranchOnCond, {CanIV});
@@ -219,7 +219,7 @@ TEST_F(VPVerifierTest, DuplicateSuccessorsOutsideRegion) {
 TEST_F(VPVerifierTest, DuplicateSuccessorsInsideRegion) {
   VPlan &Plan = getPlan();
   VPValue *Zero = Plan.getConstantInt(32, 0);
-  VPInstruction *I1 = new VPInstruction(Instruction::Add, {Zero});
+  VPInstruction *I1 = new VPInstruction(Instruction::Add, {Zero, Zero});
   auto *CanIV = new VPCanonicalIVPHIRecipe(Zero, {});
   VPInstruction *BranchOnCond =
       new VPInstruction(VPInstruction::BranchOnCond, {CanIV});
@@ -263,7 +263,7 @@ TEST_F(VPVerifierTest, BlockOutsideRegionWithParent) {
   auto *CanIV = new VPCanonicalIVPHIRecipe(Zero, {});
   VPBB2->appendRecipe(CanIV);
 
-  VPInstruction *DefI = new VPInstruction(Instruction::Add, {Zero});
+  VPInstruction *DefI = new VPInstruction(Instruction::Add, {Zero, Zero});
   VPInstruction *BranchOnCond =
       new VPInstruction(VPInstruction::BranchOnCond, {DefI});
 


        


More information about the llvm-commits mailing list