summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2016-08-05 22:09:14 +0000
committerDaniel Berlin <dberlin@dberlin.org>2016-08-05 22:09:14 +0000
commit7ac3d74017c1ff6f7f0bff864f925f3b4a399a69 (patch)
tree991dbb29a1195ed7fbd606bff5d4298d9d6edf63 /llvm/lib
parentc915a7d2e810251e28758803d5e72a8178e7b917 (diff)
downloadbcm5719-llvm-7ac3d74017c1ff6f7f0bff864f925f3b4a399a69.tar.gz
bcm5719-llvm-7ac3d74017c1ff6f7f0bff864f925f3b4a399a69.zip
[MSSA] Use depth first iterator instead of custom version.
Summary: Originally the plan was to use the custom worklist to do some block popping, and because we don't actually need a visited set. The custom one we have here is slightly broken, and it's not worth fixing vs using depth_first_iterator since we aren't going to go the route we originally were. Fixes PR28874 Reviewers: george.burgess.iv Subscribers: llvm-commits, gberry Differential Revision: https://reviews.llvm.org/D23187 llvm-svn: 277880
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Utils/MemorySSA.cpp22
1 files changed, 3 insertions, 19 deletions
diff --git a/llvm/lib/Transforms/Utils/MemorySSA.cpp b/llvm/lib/Transforms/Utils/MemorySSA.cpp
index c3c966e22ea..8455f79b811 100644
--- a/llvm/lib/Transforms/Utils/MemorySSA.cpp
+++ b/llvm/lib/Transforms/Utils/MemorySSA.cpp
@@ -1452,29 +1452,13 @@ void MemorySSA::OptimizeUses::optimizeUses() {
SmallVector<MemoryAccess *, 16> VersionStack;
SmallVector<StackInfo, 16> DomTreeWorklist;
DenseMap<MemoryLocOrCall, MemlocStackInfo> LocStackInfo;
- DomTreeWorklist.push_back({DT->getRootNode(), DT->getRootNode()->begin()});
- // Bottom of the version stack is always live on entry.
VersionStack.push_back(MSSA->getLiveOnEntryDef());
unsigned long StackEpoch = 1;
unsigned long PopEpoch = 1;
- while (!DomTreeWorklist.empty()) {
- const auto *DomNode = DomTreeWorklist.back().Node;
- const auto DomIter = DomTreeWorklist.back().Iter;
- BasicBlock *BB = DomNode->getBlock();
- optimizeUsesInBlock(BB, StackEpoch, PopEpoch, VersionStack, LocStackInfo);
- if (DomIter == DomNode->end()) {
- // Hit the end, pop the worklist
- DomTreeWorklist.pop_back();
- continue;
- }
- // Move the iterator to the next child for the next time we get to process
- // children
- ++DomTreeWorklist.back().Iter;
-
- // Now visit the next child
- DomTreeWorklist.push_back({*DomIter, (*DomIter)->begin()});
- }
+ for (const auto *DomNode : depth_first(DT->getRootNode()))
+ optimizeUsesInBlock(DomNode->getBlock(), StackEpoch, PopEpoch, VersionStack,
+ LocStackInfo);
}
void MemorySSA::buildMemorySSA() {
OpenPOWER on IntegriCloud