[llvm] 4859a59 - [VPlan] Extend recipe printing tests with underlying IR values. (NFC)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 15 03:51:16 PDT 2024
Author: Florian Hahn
Date: 2024-04-15T11:50:57+01:00
New Revision: 4859a593f4016f0a78e2fadf21722e370560c5e9
URL: https://github.com/llvm/llvm-project/commit/4859a593f4016f0a78e2fadf21722e370560c5e9
DIFF: https://github.com/llvm/llvm-project/commit/4859a593f4016f0a78e2fadf21722e370560c5e9.diff
LOG: [VPlan] Extend recipe printing tests with underlying IR values. (NFC)
Make tests added in c006b9088fa56 more interesting by using an
underlying IR value as well.
Added:
Modified:
llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
index ff0f482b833c83..cb8737a9e64d2f 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
@@ -1289,9 +1289,12 @@ TEST(VPRecipeTest, dumpRecipeUnnamedVPValuesInPlan) {
LLVMContext C;
IntegerType *Int32 = IntegerType::get(C, 32);
+ auto *AI =
+ BinaryOperator::CreateAdd(UndefValue::get(Int32), UndefValue::get(Int32));
+ AI->setName("a");
SmallVector<VPValue *, 2> Args;
VPValue *ExtVPV1 = Plan.getOrAddLiveIn(ConstantInt::get(Int32, 1));
- VPValue *ExtVPV2 = Plan.getOrAddLiveIn(ConstantInt::get(Int32, 2));
+ VPValue *ExtVPV2 = Plan.getOrAddLiveIn(AI);
Args.push_back(ExtVPV1);
Args.push_back(ExtVPV2);
VPInstruction *I1 = new VPInstruction(Instruction::Add, {ExtVPV1, ExtVPV2});
@@ -1310,7 +1313,7 @@ TEST(VPRecipeTest, dumpRecipeUnnamedVPValuesInPlan) {
VPV->dump();
exit(0);
},
- testing::ExitedWithCode(0), "EMIT vp<%1> = add ir<1>, ir<2>");
+ testing::ExitedWithCode(0), "EMIT vp<%1> = add ir<1>, ir<%a>");
// Test VPRecipeBase::dump().
VPRecipeBase *R = I1;
@@ -1319,7 +1322,7 @@ TEST(VPRecipeTest, dumpRecipeUnnamedVPValuesInPlan) {
R->dump();
exit(0);
},
- testing::ExitedWithCode(0), "EMIT vp<%1> = add ir<1>, ir<2>");
+ testing::ExitedWithCode(0), "EMIT vp<%1> = add ir<1>, ir<%a>");
// Test VPDef::dump().
VPDef *D = I1;
@@ -1328,7 +1331,7 @@ TEST(VPRecipeTest, dumpRecipeUnnamedVPValuesInPlan) {
D->dump();
exit(0);
},
- testing::ExitedWithCode(0), "EMIT vp<%1> = add ir<1>, ir<2>");
+ testing::ExitedWithCode(0), "EMIT vp<%1> = add ir<1>, ir<%a>");
}
// Check printing I2.
{
@@ -1361,13 +1364,17 @@ TEST(VPRecipeTest, dumpRecipeUnnamedVPValuesInPlan) {
},
testing::ExitedWithCode(0), "EMIT vp<%2> = mul vp<%1>, vp<%1>");
}
+ delete AI;
}
TEST(VPRecipeTest, dumpRecipeUnnamedVPValuesNotInPlanOrBlock) {
LLVMContext C;
IntegerType *Int32 = IntegerType::get(C, 32);
+ auto *AI =
+ BinaryOperator::CreateAdd(UndefValue::get(Int32), UndefValue::get(Int32));
+ AI->setName("a");
VPValue *ExtVPV1 = new VPValue(ConstantInt::get(Int32, 1));
- VPValue *ExtVPV2 = new VPValue(ConstantInt::get(Int32, 2));
+ VPValue *ExtVPV2 = new VPValue(AI);
VPInstruction *I1 = new VPInstruction(Instruction::Add, {ExtVPV1, ExtVPV2});
VPInstruction *I2 = new VPInstruction(Instruction::Mul, {I1, I1});
@@ -1383,7 +1390,7 @@ TEST(VPRecipeTest, dumpRecipeUnnamedVPValuesNotInPlanOrBlock) {
VPV->dump();
exit(0);
},
- testing::ExitedWithCode(0), "EMIT <badref> = add ir<1>, ir<2>");
+ testing::ExitedWithCode(0), "EMIT <badref> = add ir<1>, ir<%a>");
// Test VPRecipeBase::dump().
VPRecipeBase *R = I1;
@@ -1392,7 +1399,7 @@ TEST(VPRecipeTest, dumpRecipeUnnamedVPValuesNotInPlanOrBlock) {
R->dump();
exit(0);
},
- testing::ExitedWithCode(0), "EMIT <badref> = add ir<1>, ir<2>");
+ testing::ExitedWithCode(0), "EMIT <badref> = add ir<1>, ir<%a>");
// Test VPDef::dump().
VPDef *D = I1;
@@ -1401,7 +1408,7 @@ TEST(VPRecipeTest, dumpRecipeUnnamedVPValuesNotInPlanOrBlock) {
D->dump();
exit(0);
},
- testing::ExitedWithCode(0), "EMIT <badref> = add ir<1>, ir<2>");
+ testing::ExitedWithCode(0), "EMIT <badref> = add ir<1>, ir<%a>");
}
// Check printing I2.
{
@@ -1439,6 +1446,7 @@ TEST(VPRecipeTest, dumpRecipeUnnamedVPValuesNotInPlanOrBlock) {
delete I1;
delete ExtVPV2;
delete ExtVPV1;
+ delete AI;
}
#endif
More information about the llvm-commits
mailing list