[llvm] 72791fe - [VPlan] Remove unused buildPlainCFG from unit tests (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 23 05:38:56 PST 2025
Author: Florian Hahn
Date: 2025-02-23T13:38:42Z
New Revision: 72791fef6d6c84b72cb961b288b25283bea97310
URL: https://github.com/llvm/llvm-project/commit/72791fef6d6c84b72cb961b288b25283bea97310
DIFF: https://github.com/llvm/llvm-project/commit/72791fef6d6c84b72cb961b288b25283bea97310.diff
LOG: [VPlan] Remove unused buildPlainCFG from unit tests (NFC).
Also clarify the name of buildHCFG -> buildVPlan.
Added:
Modified:
llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp
llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp
llvm/unittests/Transforms/Vectorize/VPlanTestBase.h
Removed:
################################################################################
diff --git a/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp
index d787a6c977194..508bee2051918 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp
@@ -41,7 +41,7 @@ TEST_F(VPlanHCFGTest, testBuildHCFGInnerLoop) {
Function *F = M.getFunction("f");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
VPBasicBlock *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
@@ -199,7 +199,7 @@ TEST_F(VPlanHCFGTest, testVPInstructionToVPRecipesInner) {
Function *F = M.getFunction("f");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
TargetLibraryInfoImpl TLII(Triple(M.getTargetTriple()));
TargetLibraryInfo TLI(TLII);
@@ -261,7 +261,7 @@ TEST_F(VPlanHCFGTest, testBuildHCFGInnerLoopMultiExit) {
Function *F = M.getFunction("f");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// Add an external value to check we do not print the list of external values,
diff --git a/llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp
index 3a2658ea1e8dc..cd8bd4a3565e4 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp
@@ -95,7 +95,7 @@ TEST_F(VPlanSlpTest, testSlpSimple_2) {
Function *F = M.getFunction("add_x2");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
auto VPIAI = getInterleavedAccessInfo(*F, LI->getLoopFor(LoopHeader), *Plan);
VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
@@ -168,7 +168,7 @@ TEST_F(VPlanSlpTest, testSlpSimple_3) {
Function *F = M.getFunction("add_x2");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
@@ -239,7 +239,7 @@ TEST_F(VPlanSlpTest, testSlpReuse_1) {
Function *F = M.getFunction("add_x2");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
auto VPIAI = getInterleavedAccessInfo(*F, LI->getLoopFor(LoopHeader), *Plan);
VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
@@ -303,7 +303,7 @@ TEST_F(VPlanSlpTest, testSlpReuse_2) {
Function *F = M.getFunction("add_x2");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
auto VPIAI = getInterleavedAccessInfo(*F, LI->getLoopFor(LoopHeader), *Plan);
VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
@@ -441,7 +441,7 @@ TEST_F(VPlanSlpTest, testSlpReorder_1) {
Function *F = M.getFunction("add_x3");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
@@ -513,7 +513,7 @@ TEST_F(VPlanSlpTest, testSlpReorder_2) {
Function *F = M.getFunction("add_x3");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
@@ -585,7 +585,7 @@ TEST_F(VPlanSlpTest, testSlpReorder_3) {
Function *F = M.getFunction("add_x3");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
@@ -661,7 +661,7 @@ TEST_F(VPlanSlpTest, testSlpReorder_4) {
Function *F = M.getFunction("add_x3");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
@@ -721,7 +721,7 @@ TEST_F(VPlanSlpTest, testInstrsInDifferentBBs) {
Function *F = M.getFunction("add_x2");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
auto VPIAI = getInterleavedAccessInfo(*F, LI->getLoopFor(LoopHeader), *Plan);
VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
@@ -784,7 +784,7 @@ TEST_F(VPlanSlpTest, testInstrsInDifferentBBs2) {
Function *F = M.getFunction("add_x2");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
auto VPIAI = getInterleavedAccessInfo(*F, LI->getLoopFor(LoopHeader), *Plan);
VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
@@ -844,7 +844,7 @@ TEST_F(VPlanSlpTest, testSlpAtomicLoad) {
Function *F = M.getFunction("add_x2");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
auto VPIAI = getInterleavedAccessInfo(*F, LI->getLoopFor(LoopHeader), *Plan);
VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
@@ -903,7 +903,7 @@ TEST_F(VPlanSlpTest, testSlpAtomicStore) {
Function *F = M.getFunction("add_x2");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = buildHCFG(LoopHeader);
+ auto Plan = buildVPlan(LoopHeader);
auto VPIAI = getInterleavedAccessInfo(*F, LI->getLoopFor(LoopHeader), *Plan);
VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
diff --git a/llvm/unittests/Transforms/Vectorize/VPlanTestBase.h b/llvm/unittests/Transforms/Vectorize/VPlanTestBase.h
index 1836a5e39a290..8d03e91fb26c3 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanTestBase.h
+++ b/llvm/unittests/Transforms/Vectorize/VPlanTestBase.h
@@ -62,7 +62,8 @@ class VPlanTestIRBase : public testing::Test {
SE.reset(new ScalarEvolution(F, TLI, *AC, *DT, *LI));
}
- VPlanPtr buildHCFG(BasicBlock *LoopHeader) {
+ /// Build the VPlan for the loop starting from \p LoopHeader.
+ VPlanPtr buildVPlan(BasicBlock *LoopHeader) {
Function &F = *LoopHeader->getParent();
assert(!verifyFunction(F) && "input function must be valid");
doAnalysis(F);
@@ -75,21 +76,6 @@ class VPlanTestIRBase : public testing::Test {
HCFGBuilder.buildHierarchicalCFG();
return Plan;
}
-
- /// Build the VPlan plain CFG for the loop starting from \p LoopHeader.
- VPlanPtr buildPlainCFG(BasicBlock *LoopHeader) {
- Function &F = *LoopHeader->getParent();
- assert(!verifyFunction(F) && "input function must be valid");
- doAnalysis(F);
-
- Loop *L = LI->getLoopFor(LoopHeader);
- PredicatedScalarEvolution PSE(*SE, *L);
- auto Plan = VPlan::createInitialVPlan(IntegerType::get(*Ctx, 64), PSE, true,
- false, L);
- VPlanHCFGBuilder HCFGBuilder(L, LI.get(), *Plan);
- HCFGBuilder.buildPlainCFG();
- return Plan;
- }
};
class VPlanTestBase : public testing::Test {
More information about the llvm-commits
mailing list