summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/MemorySSAUpdater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/MemorySSAUpdater.cpp')
-rw-r--r--llvm/lib/Analysis/MemorySSAUpdater.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/MemorySSAUpdater.cpp b/llvm/lib/Analysis/MemorySSAUpdater.cpp
index b0f7dc69e5a..9b82808681e 100644
--- a/llvm/lib/Analysis/MemorySSAUpdater.cpp
+++ b/llvm/lib/Analysis/MemorySSAUpdater.cpp
@@ -860,13 +860,14 @@ void MemorySSAUpdater::applyInsertUpdates(ArrayRef<CFGUpdate> Updates,
SmallVector<BasicBlock *, 8> BlocksToProcess;
SmallVector<BasicBlock *, 16> BlocksWithDefsToReplace;
+ SmallVector<WeakVH, 8> InsertedPhis;
// First create MemoryPhis in all blocks that don't have one. Create in the
// order found in Updates, not in PredMap, to get deterministic numbering.
for (auto &Edge : Updates) {
BasicBlock *BB = Edge.getTo();
if (PredMap.count(BB) && !MSSA->getMemoryAccess(BB))
- MSSA->createMemoryPhi(BB);
+ InsertedPhis.push_back(MSSA->createMemoryPhi(BB));
}
// Now we'll fill in the MemoryPhis with the right incoming values.
@@ -967,6 +968,7 @@ void MemorySSAUpdater::applyInsertUpdates(ArrayRef<CFGUpdate> Updates,
IDFPhi->setIncomingValue(I, GetLastDef(IDFPhi->getIncomingBlock(I)));
} else {
IDFPhi = MSSA->createMemoryPhi(BBIDF);
+ InsertedPhis.push_back(IDFPhi);
for (auto &Pair : children<GraphDiffInvBBPair>({GD, BBIDF})) {
BasicBlock *Pi = Pair.second;
IDFPhi->addIncoming(GetLastDef(Pi), Pi);
@@ -1009,6 +1011,7 @@ void MemorySSAUpdater::applyInsertUpdates(ArrayRef<CFGUpdate> Updates,
}
}
}
+ tryRemoveTrivialPhis(InsertedPhis);
}
// Move What before Where in the MemorySSA IR.
OpenPOWER on IntegriCloud