summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Transforms/Utils/MemorySSA.cpp
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2016-03-02 21:16:28 +0000
committerDaniel Berlin <dberlin@dberlin.org>2016-03-02 21:16:28 +0000
commit6412002d2462ed6ac04b4e1730f3e7b9c309519d (patch)
treebd7df4fca20a6f4a8a1495035fa942b2c732370c /llvm/unittests/Transforms/Utils/MemorySSA.cpp
parenta0e980610136aba00482eaf49101610567b74451 (diff)
downloadbcm5719-llvm-6412002d2462ed6ac04b4e1730f3e7b9c309519d.tar.gz
bcm5719-llvm-6412002d2462ed6ac04b4e1730f3e7b9c309519d.zip
Really fix ASAN leak/etc issues with MemorySSA unittests
llvm-svn: 262519
Diffstat (limited to 'llvm/unittests/Transforms/Utils/MemorySSA.cpp')
-rw-r--r--llvm/unittests/Transforms/Utils/MemorySSA.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/llvm/unittests/Transforms/Utils/MemorySSA.cpp b/llvm/unittests/Transforms/Utils/MemorySSA.cpp
index 06571923453..48bbe476a30 100644
--- a/llvm/unittests/Transforms/Utils/MemorySSA.cpp
+++ b/llvm/unittests/Transforms/Utils/MemorySSA.cpp
@@ -21,6 +21,7 @@ using namespace llvm;
TEST(MemorySSA, RemoveMemoryAccess) {
LLVMContext &C(getGlobalContext());
+ std::unique_ptr<Module> M(new Module("Remove memory access", C));
IRBuilder<> B(C);
DataLayout DL("e-i64:64-f80:128-n8:16:32:64-S128");
TargetLibraryInfoImpl TLII;
@@ -29,13 +30,13 @@ TEST(MemorySSA, RemoveMemoryAccess) {
// We create a diamond where there is a store on one side, and then a load
// after the merge point. This enables us to test a bunch of different
// removal cases.
- std::unique_ptr<Function> F(Function::Create(
+ Function *F = Function::Create(
FunctionType::get(B.getVoidTy(), {B.getInt8PtrTy()}, false),
- GlobalValue::ExternalLinkage, "F"));
- BasicBlock *Entry(BasicBlock::Create(C, "", F.get()));
- BasicBlock *Left(BasicBlock::Create(C, "", F.get()));
- BasicBlock *Right(BasicBlock::Create(C, "", F.get()));
- BasicBlock *Merge(BasicBlock::Create(C, "", F.get()));
+ GlobalValue::ExternalLinkage, "F", M.get());
+ BasicBlock *Entry(BasicBlock::Create(C, "", F));
+ BasicBlock *Left(BasicBlock::Create(C, "", F));
+ BasicBlock *Right(BasicBlock::Create(C, "", F));
+ BasicBlock *Merge(BasicBlock::Create(C, "", F));
B.SetInsertPoint(Entry);
B.CreateCondBr(B.getTrue(), Left, Right);
B.SetInsertPoint(Left);
@@ -49,10 +50,10 @@ TEST(MemorySSA, RemoveMemoryAccess) {
std::unique_ptr<MemorySSA> MSSA(new MemorySSA(*F));
std::unique_ptr<DominatorTree> DT(new DominatorTree(*F));
std::unique_ptr<AssumptionCache> AC(new AssumptionCache(*F));
- AAResults *AA = new AAResults(TLI);
- BasicAAResult *BAA = new BasicAAResult(DL, TLI, *AC, &*DT);
- AA->addAAResult(*BAA);
- MemorySSAWalker *Walker = MSSA->buildMemorySSA(AA, &*DT);
+ AAResults AA(TLI);
+ BasicAAResult BAA(DL, TLI, *AC, &*DT);
+ AA.addAAResult(BAA);
+ std::unique_ptr<MemorySSAWalker> Walker(MSSA->buildMemorySSA(&AA, &*DT));
// Before, the load will be a use of a phi<store, liveonentry>. It should be
// the same after.
MemoryUse *LoadAccess = cast<MemoryUse>(MSSA->getMemoryAccess(LoadInst));
OpenPOWER on IntegriCloud