@@ -706,13 +706,15 @@ TEST_F(VPBasicBlockTest, reassociateBlocks) {
706706
707707#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
708708TEST_F (VPBasicBlockTest, print) {
709- VPInstruction *TC = new VPInstruction (Instruction::Add , {});
709+ VPInstruction *TC = new VPInstruction (Instruction::PHI , {});
710710 VPlan &Plan = getPlan (TC);
711+ IntegerType *Int32 = IntegerType::get (C, 32 );
712+ VPValue *Val = Plan.getOrAddLiveIn (ConstantInt::get (Int32, 1 ));
711713 VPBasicBlock *VPBB0 = Plan.getEntry ();
712714 VPBB0->appendRecipe (TC);
713715
714- VPInstruction *I1 = new VPInstruction (Instruction::Add, {});
715- VPInstruction *I2 = new VPInstruction (Instruction::Sub, {I1});
716+ VPInstruction *I1 = new VPInstruction (Instruction::Add, {Val, Val });
717+ VPInstruction *I2 = new VPInstruction (Instruction::Sub, {I1, Val });
716718 VPInstruction *I3 = new VPInstruction (Instruction::Br, {I1, I2});
717719
718720 VPBasicBlock *VPBB1 = Plan.createVPBasicBlock (" " );
@@ -722,7 +724,7 @@ TEST_F(VPBasicBlockTest, print) {
722724 VPBB1->setName (" bb1" );
723725
724726 VPInstruction *I4 = new VPInstruction (Instruction::Mul, {I2, I1});
725- VPInstruction *I5 = new VPInstruction (Instruction::Ret , {I4});
727+ VPInstruction *I5 = new VPInstruction (Instruction::Br , {I4});
726728 VPBasicBlock *VPBB2 = Plan.createVPBasicBlock (" " );
727729 VPBB2->appendRecipe (I4);
728730 VPBB2->appendRecipe (I5);
@@ -752,22 +754,22 @@ edge [fontname=Courier, fontsize=30]
752754compound=true
753755 N0 [label =
754756 "preheader:\l" +
755- " EMIT vp\<%1\> = add \l" +
757+ " EMIT-SCALAR vp\<%1\> = phi \l" +
756758 "Successor(s): bb1\l"
757759 ]
758760 N0 -> N1 [ label=""]
759761 N1 [label =
760762 "bb1:\l" +
761- " EMIT vp\<%2\> = add \l" +
762- " EMIT vp\<%3\> = sub vp\<%2\>\l" +
763+ " EMIT vp\<%2\> = add ir\<1\>, ir\<1\> \l" +
764+ " EMIT vp\<%3\> = sub vp\<%2\>, ir\<1\> \l" +
763765 " EMIT br vp\<%2\>, vp\<%3\>\l" +
764766 "Successor(s): bb2\l"
765767 ]
766768 N1 -> N2 [ label=""]
767769 N2 [label =
768770 "bb2:\l" +
769771 " EMIT vp\<%5\> = mul vp\<%3\>, vp\<%2\>\l" +
770- " EMIT ret vp\<%5\>\l" +
772+ " EMIT br vp\<%5\>\l" +
771773 "Successor(s): ir-bb\<scalar.header\>\l"
772774 ]
773775 N2 -> N3 [ label=""]
@@ -780,8 +782,8 @@ compound=true
780782 EXPECT_EQ (ExpectedStr, FullDump);
781783
782784 const char *ExpectedBlock1Str = R"( bb1:
783- EMIT vp<%2> = add
784- EMIT vp<%3> = sub vp<%2>
785+ EMIT vp<%2> = add ir<1>, ir<1>
786+ EMIT vp<%3> = sub vp<%2>, ir<1>
785787 EMIT br vp<%2>, vp<%3>
786788Successor(s): bb2
787789)" ;
@@ -793,7 +795,7 @@ Successor(s): bb2
793795 // Ensure that numbering is good when dumping the second block in isolation.
794796 const char *ExpectedBlock2Str = R"( bb2:
795797 EMIT vp<%5> = mul vp<%3>, vp<%2>
796- EMIT ret vp<%5>
798+ EMIT br vp<%5>
797799Successor(s): ir-bb<scalar.header>
798800)" ;
799801 std::string Block2Dump;
@@ -909,9 +911,12 @@ TEST_F(VPBasicBlockTest, cloneAndPrint) {
909911 VPlan &Plan = getPlan (nullptr );
910912 VPBasicBlock *VPBB0 = Plan.getEntry ();
911913
912- VPInstruction *I1 = new VPInstruction (Instruction::Add, {});
913- VPInstruction *I2 = new VPInstruction (Instruction::Sub, {I1});
914- VPInstruction *I3 = new VPInstruction (Instruction::Br, {I1, I2});
914+ IntegerType *Int32 = IntegerType::get (C, 32 );
915+ VPValue *Val = Plan.getOrAddLiveIn (ConstantInt::get (Int32, 1 ));
916+
917+ VPInstruction *I1 = new VPInstruction (Instruction::Add, {Val, Val});
918+ VPInstruction *I2 = new VPInstruction (Instruction::Sub, {I1, Val});
919+ VPInstruction *I3 = new VPInstruction (Instruction::Store, {I1, I2});
915920
916921 VPBasicBlock *VPBB1 = Plan.createVPBasicBlock (" " );
917922 VPBB1->appendRecipe (I1);
@@ -932,9 +937,9 @@ compound=true
932937 N0 -> N1 [ label=""]
933938 N1 [label =
934939 "bb1:\l" +
935- " EMIT vp\<%1\> = add \l" +
936- " EMIT vp\<%2\> = sub vp\<%1\>\l" +
937- " EMIT br vp\<%1\>, vp\<%2\>\l" +
940+ " EMIT vp\<%1\> = add ir\<1\>, ir\<1\> \l" +
941+ " EMIT vp\<%2\> = sub vp\<%1\>, ir\<1\> \l" +
942+ " EMIT store vp\<%1\>, vp\<%2\>\l" +
938943 "No successors\l"
939944 ]
940945}
0 commit comments