Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit b0ec158

Browse files
committed
Revert r336653 "[VPlan] Add VPlanTestBase.h with helper class to build VPlan for tests."
Memory leaks in tests. http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/6289/steps/check-llvm%20asan/logs/stdio Direct leak of 192 byte(s) in 1 object(s) allocated from: #0 0x554ea8 in operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:106 #1 0x56cef1 in llvm::VPlanTestBase::doAnalysis(llvm::Function&) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/Transforms/Vectorize/VPlanTestBase.h:53:14 #2 0x56bec4 in llvm::VPlanTestBase::buildHCFG(llvm::BasicBlock*) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/Transforms/Vectorize/VPlanTestBase.h:57:3 #3 0x571f1e in llvm::(anonymous namespace)::VPlanHCFGTest_testVPInstructionToVPRecipesInner_Test::TestBody() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp:119:15 #4 0xed2291 in testing::Test::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc #5 0xed44c8 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11 #6 0xed5890 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28 #7 0xef3634 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43 #8 0xef27e0 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc #9 0xebbc23 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46 #10 0xebbc23 in main /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:51 #11 0x7f65569592e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) and more. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336718 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 071f23b commit b0ec158

File tree

2 files changed

+30
-76
lines changed

2 files changed

+30
-76
lines changed

unittests/Transforms/Vectorize/VPlanHCFGTest.cpp

+30-8
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,35 @@
88
//===----------------------------------------------------------------------===//
99

1010
#include "../lib/Transforms/Vectorize/VPlan.h"
11+
#include "../lib/Transforms/Vectorize/VPlanHCFGBuilder.h"
1112
#include "../lib/Transforms/Vectorize/VPlanHCFGTransforms.h"
12-
#include "VPlanTestBase.h"
13+
#include "llvm/AsmParser/Parser.h"
14+
#include "llvm/IR/Dominators.h"
1315
#include "gtest/gtest.h"
1416

1517
namespace llvm {
1618
namespace {
1719

18-
class VPlanHCFGTest : public VPlanTestBase {};
20+
class VPlanHCFGTest : public testing::Test {
21+
protected:
22+
std::unique_ptr<DominatorTree> DT;
23+
std::unique_ptr<LoopInfo> LI;
24+
25+
VPlanHCFGTest() {}
26+
27+
VPlanPtr doBuildPlan(BasicBlock *LoopHeader) {
28+
DT.reset(new DominatorTree(*LoopHeader->getParent()));
29+
LI.reset(new LoopInfo(*DT));
30+
31+
auto Plan = llvm::make_unique<VPlan>();
32+
VPlanHCFGBuilder HCFGBuilder(LI->getLoopFor(LoopHeader), LI.get());
33+
HCFGBuilder.buildHierarchicalCFG(*Plan.get());
34+
return Plan;
35+
}
36+
};
1937

2038
TEST_F(VPlanHCFGTest, testBuildHCFGInnerLoop) {
39+
LLVMContext Ctx;
2140
const char *ModuleString =
2241
"define void @f(i32* %A, i64 %N) {\n"
2342
"entry:\n"
@@ -35,11 +54,12 @@ TEST_F(VPlanHCFGTest, testBuildHCFGInnerLoop) {
3554
" ret void\n"
3655
"}\n";
3756

38-
Module &M = parseModule(ModuleString);
57+
SMDiagnostic Err;
58+
std::unique_ptr<Module> M = parseAssemblyString(ModuleString, Err, Ctx);
3959

40-
Function *F = M.getFunction("f");
60+
Function *F = M->getFunction("f");
4161
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
42-
auto Plan = buildHCFG(LoopHeader);
62+
auto Plan = doBuildPlan(LoopHeader);
4363

4464
VPBasicBlock *Entry = Plan->getEntry()->getEntryBasicBlock();
4565
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
@@ -95,6 +115,7 @@ TEST_F(VPlanHCFGTest, testBuildHCFGInnerLoop) {
95115
}
96116

97117
TEST_F(VPlanHCFGTest, testVPInstructionToVPRecipesInner) {
118+
LLVMContext Ctx;
98119
const char *ModuleString =
99120
"define void @f(i32* %A, i64 %N) {\n"
100121
"entry:\n"
@@ -112,11 +133,12 @@ TEST_F(VPlanHCFGTest, testVPInstructionToVPRecipesInner) {
112133
" ret void\n"
113134
"}\n";
114135

115-
Module &M = parseModule(ModuleString);
136+
SMDiagnostic Err;
137+
std::unique_ptr<Module> M = parseAssemblyString(ModuleString, Err, Ctx);
116138

117-
Function *F = M.getFunction("f");
139+
Function *F = M->getFunction("f");
118140
BasicBlock *LoopHeader = F->getEntryBlock().getSingleSuccessor();
119-
auto Plan = buildHCFG(LoopHeader);
141+
auto Plan = doBuildPlan(LoopHeader);
120142

121143
LoopVectorizationLegality::InductionList Inductions;
122144
SmallPtrSet<Instruction *, 1> DeadInstructions;

unittests/Transforms/Vectorize/VPlanTestBase.h

-68
This file was deleted.

0 commit comments

Comments
 (0)