[PATCH] D23187: [MSSA] Use depth first iterator instead of custom version.
Daniel Berlin via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 4 17:45:57 PDT 2016
dberlin created this revision.
dberlin added a reviewer: george.burgess.iv.
dberlin added subscribers: gberry, llvm-commits.
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.
https://reviews.llvm.org/D23187
Files:
lib/Transforms/Utils/MemorySSA.cpp
Index: lib/Transforms/Utils/MemorySSA.cpp
===================================================================
--- lib/Transforms/Utils/MemorySSA.cpp
+++ lib/Transforms/Utils/MemorySSA.cpp
@@ -1452,29 +1452,13 @@
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() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23187.66895.patch
Type: text/x-patch
Size: 1498 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160805/72a8f6bc/attachment.bin>
More information about the llvm-commits
mailing list