@@ -35,9 +35,9 @@ namespace {
3535using VPInstructionTest = VPlanTestBase;
3636
3737TEST_F (VPInstructionTest, insertBefore) {
38- VPInstruction *I1 = new VPInstruction (0 , {});
39- VPInstruction *I2 = new VPInstruction (1 , {});
40- VPInstruction *I3 = new VPInstruction (2 , {});
38+ VPInstruction *I1 = new VPInstruction (VPInstruction::StepVector , {});
39+ VPInstruction *I2 = new VPInstruction (VPInstruction::VScale , {});
40+ VPInstruction *I3 = new VPInstruction (VPInstruction::StepVector , {});
4141
4242 VPBasicBlock &VPBB1 = *getPlan ().createVPBasicBlock (" " );
4343 VPBB1.appendRecipe (I1);
@@ -50,9 +50,9 @@ TEST_F(VPInstructionTest, insertBefore) {
5050}
5151
5252TEST_F (VPInstructionTest, eraseFromParent) {
53- VPInstruction *I1 = new VPInstruction (0 , {});
54- VPInstruction *I2 = new VPInstruction (1 , {});
55- VPInstruction *I3 = new VPInstruction (2 , {});
53+ VPInstruction *I1 = new VPInstruction (VPInstruction::StepVector , {});
54+ VPInstruction *I2 = new VPInstruction (VPInstruction::VScale , {});
55+ VPInstruction *I3 = new VPInstruction (VPInstruction::StepVector , {});
5656
5757 VPBasicBlock &VPBB1 = *getPlan ().createVPBasicBlock (" " );
5858 VPBB1.appendRecipe (I1);
@@ -70,9 +70,9 @@ TEST_F(VPInstructionTest, eraseFromParent) {
7070}
7171
7272TEST_F (VPInstructionTest, moveAfter) {
73- VPInstruction *I1 = new VPInstruction (0 , {});
74- VPInstruction *I2 = new VPInstruction (1 , {});
75- VPInstruction *I3 = new VPInstruction (2 , {});
73+ VPInstruction *I1 = new VPInstruction (VPInstruction::StepVector , {});
74+ VPInstruction *I2 = new VPInstruction (VPInstruction::VScale , {});
75+ VPInstruction *I3 = new VPInstruction (VPInstruction::StepVector , {});
7676
7777 VPBasicBlock &VPBB1 = *getPlan ().createVPBasicBlock (" " );
7878 VPBB1.appendRecipe (I1);
@@ -83,8 +83,8 @@ TEST_F(VPInstructionTest, moveAfter) {
8383
8484 CHECK_ITERATOR (VPBB1, I2, I1, I3);
8585
86- VPInstruction *I4 = new VPInstruction (4 , {});
87- VPInstruction *I5 = new VPInstruction (5 , {});
86+ VPInstruction *I4 = new VPInstruction (VPInstruction::VScale , {});
87+ VPInstruction *I5 = new VPInstruction (VPInstruction::StepVector , {});
8888 VPBasicBlock &VPBB2 = *getPlan ().createVPBasicBlock (" " );
8989 VPBB2.appendRecipe (I4);
9090 VPBB2.appendRecipe (I5);
@@ -97,9 +97,9 @@ TEST_F(VPInstructionTest, moveAfter) {
9797}
9898
9999TEST_F (VPInstructionTest, moveBefore) {
100- VPInstruction *I1 = new VPInstruction (0 , {});
101- VPInstruction *I2 = new VPInstruction (1 , {});
102- VPInstruction *I3 = new VPInstruction (2 , {});
100+ VPInstruction *I1 = new VPInstruction (VPInstruction::StepVector , {});
101+ VPInstruction *I2 = new VPInstruction (VPInstruction::VScale , {});
102+ VPInstruction *I3 = new VPInstruction (VPInstruction::StepVector , {});
103103
104104 VPBasicBlock &VPBB1 = *getPlan ().createVPBasicBlock (" " );
105105 VPBB1.appendRecipe (I1);
@@ -110,8 +110,8 @@ TEST_F(VPInstructionTest, moveBefore) {
110110
111111 CHECK_ITERATOR (VPBB1, I2, I1, I3);
112112
113- VPInstruction *I4 = new VPInstruction (4 , {});
114- VPInstruction *I5 = new VPInstruction (5 , {});
113+ VPInstruction *I4 = new VPInstruction (VPInstruction::VScale , {});
114+ VPInstruction *I5 = new VPInstruction (VPInstruction::StepVector , {});
115115 VPBasicBlock &VPBB2 = *getPlan ().createVPBasicBlock (" " );
116116 VPBB2.appendRecipe (I4);
117117 VPBB2.appendRecipe (I5);
@@ -136,7 +136,7 @@ TEST_F(VPInstructionTest, setOperand) {
136136 IntegerType *Int32 = IntegerType::get (C, 32 );
137137 VPValue *VPV1 = getPlan ().getOrAddLiveIn (ConstantInt::get (Int32, 1 ));
138138 VPValue *VPV2 = getPlan ().getOrAddLiveIn (ConstantInt::get (Int32, 2 ));
139- VPInstruction *I1 = new VPInstruction (0 , {VPV1, VPV2});
139+ VPInstruction *I1 = new VPInstruction (Instruction::Add , {VPV1, VPV2});
140140 EXPECT_EQ (1u , VPV1->getNumUsers ());
141141 EXPECT_EQ (I1, *VPV1->user_begin ());
142142 EXPECT_EQ (1u , VPV2->getNumUsers ());
@@ -179,7 +179,7 @@ TEST_F(VPInstructionTest, replaceAllUsesWith) {
179179 IntegerType *Int32 = IntegerType::get (C, 32 );
180180 VPValue *VPV1 = getPlan ().getOrAddLiveIn (ConstantInt::get (Int32, 1 ));
181181 VPValue *VPV2 = getPlan ().getOrAddLiveIn (ConstantInt::get (Int32, 2 ));
182- VPInstruction *I1 = new VPInstruction (0 , {VPV1, VPV2});
182+ VPInstruction *I1 = new VPInstruction (Instruction::Add , {VPV1, VPV2});
183183
184184 // Replace all uses of VPV1 with VPV3.
185185 VPValue *VPV3 = getPlan ().getOrAddLiveIn (ConstantInt::get (Int32, 3 ));
@@ -210,7 +210,7 @@ TEST_F(VPInstructionTest, replaceAllUsesWith) {
210210 EXPECT_EQ (0u , VPV2->getNumUsers ());
211211 EXPECT_EQ (0u , VPV3->getNumUsers ());
212212
213- VPInstruction *I2 = new VPInstruction (0 , {VPV1, VPV2});
213+ VPInstruction *I2 = new VPInstruction (Instruction::Add , {VPV1, VPV2});
214214 EXPECT_EQ (3u , VPV1->getNumUsers ());
215215 VPV1->replaceAllUsesWith (VPV3);
216216 EXPECT_EQ (3u , VPV3->getNumUsers ());
@@ -223,7 +223,7 @@ TEST_F(VPInstructionTest, releaseOperandsAtDeletion) {
223223 IntegerType *Int32 = IntegerType::get (C, 32 );
224224 VPValue *VPV1 = getPlan ().getOrAddLiveIn (ConstantInt::get (Int32, 1 ));
225225 VPValue *VPV2 = getPlan ().getOrAddLiveIn (ConstantInt::get (Int32, 1 ));
226- VPInstruction *I1 = new VPInstruction (0 , {VPV1, VPV2});
226+ VPInstruction *I1 = new VPInstruction (Instruction::Add , {VPV1, VPV2});
227227
228228 EXPECT_EQ (1u , VPV1->getNumUsers ());
229229 EXPECT_EQ (I1, *VPV1->user_begin ());
@@ -706,7 +706,7 @@ TEST_F(VPBasicBlockTest, reassociateBlocks) {
706706
707707TEST_F (VPBasicBlockTest, splitAtEnd) {
708708 VPlan &Plan = getPlan ();
709- VPInstruction *VPI = new VPInstruction (0 , {});
709+ VPInstruction *VPI = new VPInstruction (VPInstruction::StepVector , {});
710710 VPBasicBlock *VPBB = Plan.createVPBasicBlock (" VPBB1" , VPI);
711711 VPBlockUtils::connectBlocks (Plan.getEntry (), VPBB);
712712 VPBlockUtils::connectBlocks (VPBB, Plan.getScalarHeader ());
@@ -727,7 +727,7 @@ TEST_F(VPBasicBlockTest, print) {
727727
728728 VPInstruction *I1 = new VPInstruction (Instruction::Add, {Val, Val});
729729 VPInstruction *I2 = new VPInstruction (Instruction::Sub, {I1, Val});
730- VPInstruction *I3 = new VPInstruction (Instruction::Br , {I1, I2});
730+ VPInstruction *I3 = new VPInstruction (Instruction::Store , {I1, I2});
731731
732732 VPBasicBlock *VPBB1 = Plan.createVPBasicBlock (" " );
733733 VPBB1->appendRecipe (I1);
@@ -736,7 +736,7 @@ TEST_F(VPBasicBlockTest, print) {
736736 VPBB1->setName (" bb1" );
737737
738738 VPInstruction *I4 = new VPInstruction (Instruction::Mul, {I2, I1});
739- VPInstruction *I5 = new VPInstruction (Instruction::Br , {I4});
739+ VPInstruction *I5 = new VPInstruction (Instruction::Freeze , {I4});
740740 VPBasicBlock *VPBB2 = Plan.createVPBasicBlock (" " );
741741 VPBB2->appendRecipe (I4);
742742 VPBB2->appendRecipe (I5);
@@ -750,7 +750,7 @@ TEST_F(VPBasicBlockTest, print) {
750750 raw_string_ostream OS (I3Dump);
751751 VPSlotTracker SlotTracker;
752752 I3->print (OS, " " , SlotTracker);
753- EXPECT_EQ (" EMIT br <badref>, <badref>" , I3Dump);
753+ EXPECT_EQ (" EMIT store <badref>, <badref>" , I3Dump);
754754 }
755755
756756 VPBlockUtils::connectBlocks (VPBB2, Plan.getScalarHeader ());
@@ -773,14 +773,14 @@ compound=true
773773 "bb1:\l" +
774774 " EMIT vp\<%1\> = add ir\<1\>, ir\<1\>\l" +
775775 " EMIT vp\<%2\> = sub vp\<%1\>, ir\<1\>\l" +
776- " EMIT br vp\<%1\>, vp\<%2\>\l" +
776+ " EMIT store vp\<%1\>, vp\<%2\>\l" +
777777 "Successor(s): bb2\l"
778778 ]
779779 N1 -> N2 [ label=""]
780780 N2 [label =
781781 "bb2:\l" +
782782 " EMIT vp\<%4\> = mul vp\<%2\>, vp\<%1\>\l" +
783- " EMIT br vp\<%4\>\l" +
783+ " EMIT vp\<%5\> = freeze vp\<%4\>\l" +
784784 "Successor(s): ir-bb\<scalar.header\>\l"
785785 ]
786786 N2 -> N3 [ label=""]
@@ -795,7 +795,7 @@ compound=true
795795 const char *ExpectedBlock1Str = R"( bb1:
796796 EMIT vp<%1> = add ir<1>, ir<1>
797797 EMIT vp<%2> = sub vp<%1>, ir<1>
798- EMIT br vp<%1>, vp<%2>
798+ EMIT store vp<%1>, vp<%2>
799799Successor(s): bb2
800800)" ;
801801 std::string Block1Dump;
@@ -806,7 +806,7 @@ Successor(s): bb2
806806 // Ensure that numbering is good when dumping the second block in isolation.
807807 const char *ExpectedBlock2Str = R"( bb2:
808808 EMIT vp<%4> = mul vp<%2>, vp<%1>
809- EMIT br vp<%4>
809+ EMIT vp<%5> = freeze vp<%4>
810810Successor(s): ir-bb<scalar.header>
811811)" ;
812812 std::string Block2Dump;
@@ -819,7 +819,7 @@ Successor(s): ir-bb<scalar.header>
819819 raw_string_ostream OS (I3Dump);
820820 VPSlotTracker SlotTracker (&Plan);
821821 I3->print (OS, " " , SlotTracker);
822- EXPECT_EQ (" EMIT br vp<%1>, vp<%2>" , I3Dump);
822+ EXPECT_EQ (" EMIT store vp<%1>, vp<%2>" , I3Dump);
823823 }
824824
825825 {
@@ -832,9 +832,11 @@ Successor(s): ir-bb<scalar.header>
832832
833833TEST_F (VPBasicBlockTest, printPlanWithVFsAndUFs) {
834834 VPlan &Plan = getPlan ();
835+ IntegerType *Int32 = IntegerType::get (C, 32 );
836+ VPValue *Val = Plan.getOrAddLiveIn (ConstantInt::get (Int32, 1 ));
835837 VPBasicBlock *VPBB0 = Plan.getEntry ();
836838
837- VPInstruction *I1 = new VPInstruction (Instruction::Add, {});
839+ VPInstruction *I1 = new VPInstruction (Instruction::Add, {Val, Val });
838840 VPBasicBlock *VPBB1 = Plan.createVPBasicBlock (" " );
839841 VPBB1->appendRecipe (I1);
840842 VPBB1->setName (" bb1" );
@@ -856,7 +858,7 @@ Live-in ir<1024> = original trip-count
856858Successor(s): bb1
857859
858860bb1:
859- EMIT vp<%1> = add
861+ EMIT vp<%1> = add ir<1>, ir<1>
860862Successor(s): ir-bb<scalar.header>
861863
862864ir-bb<scalar.header>:
@@ -879,7 +881,7 @@ Live-in ir<1024> = original trip-count
879881Successor(s): bb1
880882
881883bb1:
882- EMIT vp<%1> = add
884+ EMIT vp<%1> = add ir<1>, ir<1>
883885Successor(s): ir-bb<scalar.header>
884886
885887ir-bb<scalar.header>:
@@ -902,7 +904,7 @@ Live-in ir<1024> = original trip-count
902904Successor(s): bb1
903905
904906bb1:
905- EMIT vp<%1> = add
907+ EMIT vp<%1> = add ir<1>, ir<1>
906908Successor(s): ir-bb<scalar.header>
907909
908910ir-bb<scalar.header>:
@@ -1736,15 +1738,15 @@ TEST(VPDoubleValueDefTest, traverseUseLists) {
17361738 // directions.
17371739
17381740 // Create a new VPDef which defines 2 values and has 2 operands.
1739- VPInstruction Op0 (20 , {});
1740- VPInstruction Op1 (30 , {});
1741+ VPInstruction Op0 (VPInstruction::StepVector , {});
1742+ VPInstruction Op1 (VPInstruction::VScale , {});
17411743 VPDoubleValueDef DoubleValueDef ({&Op0, &Op1});
17421744
17431745 // Create a new users of the defined values.
1744- VPInstruction I1 (
1745- 1 , {DoubleValueDef. getVPValue ( 0 ), DoubleValueDef.getVPValue (1 )});
1746- VPInstruction I2 (2 , {DoubleValueDef.getVPValue (0 )});
1747- VPInstruction I3 (3 , {DoubleValueDef.getVPValue (1 )});
1746+ VPInstruction I1 (Instruction::Add, {DoubleValueDef. getVPValue ( 0 ),
1747+ DoubleValueDef.getVPValue (1 )});
1748+ VPInstruction I2 (Instruction::Freeze , {DoubleValueDef.getVPValue (0 )});
1749+ VPInstruction I3 (Instruction::Freeze , {DoubleValueDef.getVPValue (1 )});
17481750
17491751 // Check operands of the VPDef (traversing upwards).
17501752 SmallVector<VPValue *, 4 > DoubleOperands (DoubleValueDef.op_begin (),
0 commit comments