forked from OSchip/llvm-project
Revert "Fix ASAN detected errors in code and test" (it was not meant to be committed yet)
This reverts commit 890bbccd600ba1eb050353d06a29650ad0f2eb95. llvm-svn: 262512
This commit is contained in:
parent
27ed1c2eb0
commit
989e601b26
|
@ -231,7 +231,7 @@ MemorySSAWalker *MemorySSA::buildMemorySSA(AliasAnalysis *AA,
|
|||
assert(!this->AA && !this->DT &&
|
||||
"MemorySSA without a walker already has AA or DT?");
|
||||
|
||||
Walker = new CachingMemorySSAWalker(this, AA, DT);
|
||||
auto *Result = new CachingMemorySSAWalker(this, AA, DT);
|
||||
this->AA = AA;
|
||||
this->DT = DT;
|
||||
|
||||
|
@ -343,7 +343,7 @@ MemorySSAWalker *MemorySSA::buildMemorySSA(AliasAnalysis *AA,
|
|||
for (auto &MA : *Accesses) {
|
||||
if (auto *MU = dyn_cast<MemoryUse>(&MA)) {
|
||||
Instruction *Inst = MU->getMemoryInst();
|
||||
MU->setDefiningAccess(Walker->getClobberingMemoryAccess(Inst));
|
||||
MU->setDefiningAccess(Result->getClobberingMemoryAccess(Inst));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -354,6 +354,7 @@ MemorySSAWalker *MemorySSA::buildMemorySSA(AliasAnalysis *AA,
|
|||
if (!Visited.count(&BB))
|
||||
markUnreachableAsLiveOnEntry(&BB);
|
||||
|
||||
Walker = Result;
|
||||
return Walker;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ 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;
|
||||
|
@ -30,13 +29,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.
|
||||
Function *F = Function::Create(
|
||||
std::unique_ptr<Function> F(Function::Create(
|
||||
FunctionType::get(B.getVoidTy(), {B.getInt8PtrTy()}, false),
|
||||
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));
|
||||
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()));
|
||||
B.SetInsertPoint(Entry);
|
||||
B.CreateCondBr(B.getTrue(), Left, Right);
|
||||
B.SetInsertPoint(Left);
|
||||
|
@ -50,10 +49,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;
|
||||
BasicAAResult BAA(DL, TLI, *AC, &*DT);
|
||||
AA.addAAResult(BAA);
|
||||
std::unique_ptr<MemorySSAWalker> Walker(MSSA->buildMemorySSA(&AA, &*DT));
|
||||
AAResults *AA = new AAResults(TLI);
|
||||
BasicAAResult *BAA = new BasicAAResult(DL, TLI, *AC, &*DT);
|
||||
AA->addAAResult(*BAA);
|
||||
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));
|
||||
|
|
Loading…
Reference in New Issue