[llvm] r314847 - [Dominators] Make eraseNode invalidate DFS numbers

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 14:17:48 PDT 2017


Author: kuhar
Date: Tue Oct  3 14:17:48 2017
New Revision: 314847

URL: http://llvm.org/viewvc/llvm-project?rev=314847&view=rev
Log:
[Dominators] Make eraseNode invalidate DFS numbers

This patch makes DT::eraseNode mark DFSInfo as invalid.
Not marking it as invalid leads to DFS numbers getting corrupted
and failing VerifyDFSNumbers check.

This patch also makes children iterator const (NFC).

Modified:
    llvm/trunk/include/llvm/Support/GenericDomTree.h

Modified: llvm/trunk/include/llvm/Support/GenericDomTree.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GenericDomTree.h?rev=314847&r1=314846&r2=314847&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/GenericDomTree.h (original)
+++ llvm/trunk/include/llvm/Support/GenericDomTree.h Tue Oct  3 14:17:48 2017
@@ -637,11 +637,12 @@ class DominatorTreeBase {
     assert(Node && "Removing node that isn't in dominator tree.");
     assert(Node->getChildren().empty() && "Node is not a leaf node.");
 
+    DFSInfoValid = false;
+
     // Remove node from immediate dominator's children list.
     DomTreeNodeBase<NodeT> *IDom = Node->getIDom();
     if (IDom) {
-      typename std::vector<DomTreeNodeBase<NodeT> *>::iterator I =
-          find(IDom->Children, Node);
+      const auto I = find(IDom->Children, Node);
       assert(I != IDom->Children.end() &&
              "Not in immediate dominator children set!");
       // I am no longer your child...




More information about the llvm-commits mailing list