[PATCH] D30109: [MemorySSA] NFC small fixes

Piotr Padlewski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 18 12:46:22 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL295566: [MemorySSA] NFC small fixes (authored by Prazek).

Changed prior to commit:
  https://reviews.llvm.org/D30109?vs=88935&id=89037#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30109

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
@@ -1322,14 +1322,18 @@
 
   // Pop everything that doesn't dominate the current block off the stack,
   // increment the PopEpoch to account for this.
-  while (!VersionStack.empty()) {
+  while (true) {
+    assert(
+        !VersionStack.empty() &&
+        "Version stack should have liveOnEntry sentinel dominating everything");
     BasicBlock *BackBlock = VersionStack.back()->getBlock();
     if (DT->dominates(BackBlock, BB))
       break;
     while (VersionStack.back()->getBlock() == BackBlock)
       VersionStack.pop_back();
     ++PopEpoch;
   }
+
   for (MemoryAccess &MA : *Accesses) {
     auto *MU = dyn_cast<MemoryUse>(&MA);
     if (!MU) {
@@ -1450,20 +1454,13 @@
 
 /// Optimize uses to point to their actual clobbering definitions.
 void MemorySSA::OptimizeUses::optimizeUses() {
-
-  // We perform a non-recursive top-down dominator tree walk
-  struct StackInfo {
-    const DomTreeNode *Node;
-    DomTreeNode::const_iterator Iter;
-  };
-
   SmallVector<MemoryAccess *, 16> VersionStack;
-  SmallVector<StackInfo, 16> DomTreeWorklist;
   DenseMap<MemoryLocOrCall, MemlocStackInfo> LocStackInfo;
   VersionStack.push_back(MSSA->getLiveOnEntryDef());
 
   unsigned long StackEpoch = 1;
   unsigned long PopEpoch = 1;
+  // We perform a non-recursive top-down dominator tree walk.
   for (const auto *DomNode : depth_first(DT->getRootNode()))
     optimizeUsesInBlock(DomNode->getBlock(), StackEpoch, PopEpoch, VersionStack,
                         LocStackInfo);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30109.89037.patch
Type: text/x-patch
Size: 1710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170218/0ec7c14c/attachment.bin>


More information about the llvm-commits mailing list