[PATCH] D23187: [MSSA] Use depth first iterator instead of custom version.

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 15:17:07 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL277880: [MSSA] Use depth first iterator instead of custom version. (authored by dannyb).

Changed prior to commit:
  https://reviews.llvm.org/D23187?vs=66895&id=67034#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23187

Files:
  llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp

Index: llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp
+++ llvm/trunk/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.67034.patch
Type: text/x-patch
Size: 1531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160805/765ebcb4/attachment.bin>


More information about the llvm-commits mailing list