@@ -706,13 +706,15 @@ TEST_F(VPBasicBlockTest, reassociateBlocks) {
706
706
707
707
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
708
708
TEST_F (VPBasicBlockTest, print) {
709
- VPInstruction *TC = new VPInstruction (Instruction::Add , {});
709
+ VPInstruction *TC = new VPInstruction (Instruction::PHI , {});
710
710
VPlan &Plan = getPlan (TC);
711
+ IntegerType *Int32 = IntegerType::get (C, 32 );
712
+ VPValue *Val = Plan.getOrAddLiveIn (ConstantInt::get (Int32, 1 ));
711
713
VPBasicBlock *VPBB0 = Plan.getEntry ();
712
714
VPBB0->appendRecipe (TC);
713
715
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 });
716
718
VPInstruction *I3 = new VPInstruction (Instruction::Br, {I1, I2});
717
719
718
720
VPBasicBlock *VPBB1 = Plan.createVPBasicBlock (" " );
@@ -722,7 +724,7 @@ TEST_F(VPBasicBlockTest, print) {
722
724
VPBB1->setName (" bb1" );
723
725
724
726
VPInstruction *I4 = new VPInstruction (Instruction::Mul, {I2, I1});
725
- VPInstruction *I5 = new VPInstruction (Instruction::Ret , {I4});
727
+ VPInstruction *I5 = new VPInstruction (Instruction::Br , {I4});
726
728
VPBasicBlock *VPBB2 = Plan.createVPBasicBlock (" " );
727
729
VPBB2->appendRecipe (I4);
728
730
VPBB2->appendRecipe (I5);
@@ -752,22 +754,22 @@ edge [fontname=Courier, fontsize=30]
752
754
compound=true
753
755
N0 [label =
754
756
"preheader:\l" +
755
- " EMIT vp\<%1\> = add \l" +
757
+ " EMIT-SCALAR vp\<%1\> = phi \l" +
756
758
"Successor(s): bb1\l"
757
759
]
758
760
N0 -> N1 [ label=""]
759
761
N1 [label =
760
762
"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" +
763
765
" EMIT br vp\<%2\>, vp\<%3\>\l" +
764
766
"Successor(s): bb2\l"
765
767
]
766
768
N1 -> N2 [ label=""]
767
769
N2 [label =
768
770
"bb2:\l" +
769
771
" EMIT vp\<%5\> = mul vp\<%3\>, vp\<%2\>\l" +
770
- " EMIT ret vp\<%5\>\l" +
772
+ " EMIT br vp\<%5\>\l" +
771
773
"Successor(s): ir-bb\<scalar.header\>\l"
772
774
]
773
775
N2 -> N3 [ label=""]
@@ -780,8 +782,8 @@ compound=true
780
782
EXPECT_EQ (ExpectedStr, FullDump);
781
783
782
784
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>
785
787
EMIT br vp<%2>, vp<%3>
786
788
Successor(s): bb2
787
789
)" ;
@@ -793,7 +795,7 @@ Successor(s): bb2
793
795
// Ensure that numbering is good when dumping the second block in isolation.
794
796
const char *ExpectedBlock2Str = R"( bb2:
795
797
EMIT vp<%5> = mul vp<%3>, vp<%2>
796
- EMIT ret vp<%5>
798
+ EMIT br vp<%5>
797
799
Successor(s): ir-bb<scalar.header>
798
800
)" ;
799
801
std::string Block2Dump;
@@ -909,9 +911,12 @@ TEST_F(VPBasicBlockTest, cloneAndPrint) {
909
911
VPlan &Plan = getPlan (nullptr );
910
912
VPBasicBlock *VPBB0 = Plan.getEntry ();
911
913
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});
915
920
916
921
VPBasicBlock *VPBB1 = Plan.createVPBasicBlock (" " );
917
922
VPBB1->appendRecipe (I1);
@@ -932,9 +937,9 @@ compound=true
932
937
N0 -> N1 [ label=""]
933
938
N1 [label =
934
939
"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" +
938
943
"No successors\l"
939
944
]
940
945
}
0 commit comments