diff options
author | Alina Sbirlea <asbirlea@google.com> | 2018-06-29 20:46:16 +0000 |
---|---|---|
committer | Alina Sbirlea <asbirlea@google.com> | 2018-06-29 20:46:16 +0000 |
commit | da1e80feb7609a6626836c8cd675ff7171e4bb04 (patch) | |
tree | 29fb455c784aaa4822f6fe43176e9b956e8c3dec /llvm/lib/Analysis/MemorySSA.cpp | |
parent | 2bd91dbd627f94e3374cc4be53ab5694d90d3e21 (diff) | |
download | bcm5719-llvm-da1e80feb7609a6626836c8cd675ff7171e4bb04.tar.gz bcm5719-llvm-da1e80feb7609a6626836c8cd675ff7171e4bb04.zip |
[MemorySSA] Add APIs to MemoryPhis to delete incoming blocks/values, and an updater API to remove blocks.
Summary:
MemoryPhis now have APIs analogous to BB Phis to remove an incoming value/block.
The MemorySSAUpdater uses the above APIs when updating MemorySSA given a set of dead blocks about to be deleted.
Reviewers: george.burgess.iv
Subscribers: sanjoy, jlebar, Prazek, llvm-commits
Differential Revision: https://reviews.llvm.org/D48396
llvm-svn: 336015
Diffstat (limited to 'llvm/lib/Analysis/MemorySSA.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemorySSA.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp index 9c7fbd08e60..fe89c1d9570 100644 --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -1597,10 +1597,11 @@ void MemorySSA::removeFromLookups(MemoryAccess *MA) { /// ShouldDelete defaults to true, and will cause the memory access to also be /// deleted, not just removed. void MemorySSA::removeFromLists(MemoryAccess *MA, bool ShouldDelete) { + BasicBlock *BB = MA->getBlock(); // The access list owns the reference, so we erase it from the non-owning list // first. if (!isa<MemoryUse>(MA)) { - auto DefsIt = PerBlockDefs.find(MA->getBlock()); + auto DefsIt = PerBlockDefs.find(BB); std::unique_ptr<DefsList> &Defs = DefsIt->second; Defs->remove(*MA); if (Defs->empty()) @@ -1609,15 +1610,17 @@ void MemorySSA::removeFromLists(MemoryAccess *MA, bool ShouldDelete) { // The erase call here will delete it. If we don't want it deleted, we call // remove instead. - auto AccessIt = PerBlockAccesses.find(MA->getBlock()); + auto AccessIt = PerBlockAccesses.find(BB); std::unique_ptr<AccessList> &Accesses = AccessIt->second; if (ShouldDelete) Accesses->erase(MA); else Accesses->remove(MA); - if (Accesses->empty()) + if (Accesses->empty()) { PerBlockAccesses.erase(AccessIt); + BlockNumberingValid.erase(BB); + } } void MemorySSA::print(raw_ostream &OS) const { |