summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2018-07-11 11:54:30 +0000
committerFlorian Hahn <florian.hahn@arm.com>2018-07-11 11:54:30 +0000
commit7e64c1ee9123071d64cd019e3344ca7781fd8b3b (patch)
tree7d42a1e5c068523fd7719367f7095000f9506131 /llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp
parenteca0e633d19867acec6fd112113057092387790b (diff)
downloadbcm5719-llvm-7e64c1ee9123071d64cd019e3344ca7781fd8b3b.tar.gz
bcm5719-llvm-7e64c1ee9123071d64cd019e3344ca7781fd8b3b.zip
Recommit r336653: [VPlan] Add VPlanTestBase.h with helper
The original version caused a memsan failure. llvm-svn: 336792
Diffstat (limited to 'llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp')
-rw-r--r--llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp38
1 files changed, 8 insertions, 30 deletions
diff --git a/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp
index e2b8a8ab5d8..215c3ef40da 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp
@@ -8,35 +8,16 @@
//===----------------------------------------------------------------------===//
#include "../lib/Transforms/Vectorize/VPlan.h"
-#include "../lib/Transforms/Vectorize/VPlanHCFGBuilder.h"
#include "../lib/Transforms/Vectorize/VPlanHCFGTransforms.h"
-#include "llvm/AsmParser/Parser.h"
-#include "llvm/IR/Dominators.h"
+#include "VPlanTestBase.h"
#include "gtest/gtest.h"
namespace llvm {
namespace {
-class VPlanHCFGTest : public testing::Test {
-protected:
- std::unique_ptr<DominatorTree> DT;
- std::unique_ptr<LoopInfo> LI;
-
- VPlanHCFGTest() {}
-
- VPlanPtr doBuildPlan(BasicBlock *LoopHeader) {
- DT.reset(new DominatorTree(*LoopHeader->getParent()));
- LI.reset(new LoopInfo(*DT));
-
- auto Plan = llvm::make_unique<VPlan>();
- VPlanHCFGBuilder HCFGBuilder(LI->getLoopFor(LoopHeader), LI.get());
- HCFGBuilder.buildHierarchicalCFG(*Plan.get());
- return Plan;
- }
-};
+class VPlanHCFGTest : public VPlanTestBase {};
TEST_F(VPlanHCFGTest, testBuildHCFGInnerLoop) {
- LLVMContext Ctx;
const char *ModuleString =
"define void @f(i32* %A, i64 %N) {\n"
"entry:\n"
@@ -54,12 +35,11 @@ TEST_F(VPlanHCFGTest, testBuildHCFGInnerLoop) {
" ret void\n"
"}\n";
- SMDiagnostic Err;
- std::unique_ptr<Module> M = parseAssemblyString(ModuleString, Err, Ctx);
+ Module &M = parseModule(ModuleString);
- Function *F = M->getFunction("f");
+ Function *F = M.getFunction("f");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = doBuildPlan(LoopHeader);
+ auto Plan = buildHCFG(LoopHeader);
VPBasicBlock *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
@@ -115,7 +95,6 @@ TEST_F(VPlanHCFGTest, testBuildHCFGInnerLoop) {
}
TEST_F(VPlanHCFGTest, testVPInstructionToVPRecipesInner) {
- LLVMContext Ctx;
const char *ModuleString =
"define void @f(i32* %A, i64 %N) {\n"
"entry:\n"
@@ -133,12 +112,11 @@ TEST_F(VPlanHCFGTest, testVPInstructionToVPRecipesInner) {
" ret void\n"
"}\n";
- SMDiagnostic Err;
- std::unique_ptr<Module> M = parseAssemblyString(ModuleString, Err, Ctx);
+ Module &M = parseModule(ModuleString);
- Function *F = M->getFunction("f");
+ Function *F = M.getFunction("f");
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
- auto Plan = doBuildPlan(LoopHeader);
+ auto Plan = buildHCFG(LoopHeader);
LoopVectorizationLegality::InductionList Inductions;
SmallPtrSet<Instruction *, 1> DeadInstructions;
OpenPOWER on IntegriCloud