]> granicus.if.org Git - llvm/commitdiff
[Dominators] Make eraseNode invalidate DFS numbers
authorJakub Kuderski <kubakuderski@gmail.com>
Tue, 3 Oct 2017 21:17:48 +0000 (21:17 +0000)
committerJakub Kuderski <kubakuderski@gmail.com>
Tue, 3 Oct 2017 21:17:48 +0000 (21:17 +0000)
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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314847 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/GenericDomTree.h

index c4dd18751f4ac5f4355c0732a19688cf06ca7f76..8d9640f76fd6754aef0fb03eff94c048da3665fe 100644 (file)
@@ -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...