diff options
author | Alina Sbirlea <asbirlea@google.com> | 2018-07-11 22:11:46 +0000 |
---|---|---|
committer | Alina Sbirlea <asbirlea@google.com> | 2018-07-11 22:11:46 +0000 |
commit | 0f53355e83a7b20a892850aef0266a41a9f1c446 (patch) | |
tree | a163c51882fecd723125ec3a310dbe34b1b3e62e /llvm/lib/Analysis/MemorySSA.cpp | |
parent | a09b9317f5a1dcd29efd1253c6ee29faefd477fe (diff) | |
download | bcm5719-llvm-0f53355e83a7b20a892850aef0266a41a9f1c446.tar.gz bcm5719-llvm-0f53355e83a7b20a892850aef0266a41a9f1c446.zip |
[MemorySSA] Add APIs to move memory accesses between blocks, following CFG changes.
Summary:
The move APIs added in this patch will be used to update MemorySSA when CFG changes merge or split blocks, by moving memory accesses accordingly in MemorySSA's internal data structures.
[Split from D45299 for easier review]
Reviewers: george.burgess.iv
Subscribers: sanjoy, jlebar, Prazek, llvm-commits
Differential Revision: https://reviews.llvm.org/D48897
llvm-svn: 336860
Diffstat (limited to 'llvm/lib/Analysis/MemorySSA.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemorySSA.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp index fe89c1d9570..f57d490ce96 100644 --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -1473,8 +1473,18 @@ void MemorySSA::moveTo(MemoryUseOrDef *What, BasicBlock *BB, insertIntoListsBefore(What, BB, Where); } -void MemorySSA::moveTo(MemoryUseOrDef *What, BasicBlock *BB, +void MemorySSA::moveTo(MemoryAccess *What, BasicBlock *BB, InsertionPlace Point) { + if (isa<MemoryPhi>(What)) { + assert(Point == Beginning && + "Can only move a Phi at the beginning of the block"); + // Update lookup table entry + ValueToMemoryAccess.erase(What->getBlock()); + bool Inserted = ValueToMemoryAccess.insert({BB, What}).second; + (void)Inserted; + assert(Inserted && "Cannot move a Phi to a block that already has one"); + } + removeFromLists(What, false); What->setBlock(BB); insertIntoListsForBlock(What, BB, Point); |