[PATCH] D38331: [Dominators] Add DFS number verification

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 2 08:47:22 PDT 2017


dberlin added inline comments.


================
Comment at: include/llvm/Support/GenericDomTreeConstruction.h:1395
+      // Make a copy and sort is such that it is possible to check if there are
+      // no gaps between DFS numbers of adjacent children.
+      auto Children = Node->getChildren();
----------------
kuhar wrote:
> dberlin wrote:
> > My only concern here is that this mutates the tree in a verification function.
> > Given its verification, i would probably push the children and dfs numbers into a new vector, and sort + check that, to avoid mutating the tree.
> It doesn't mutate children here -- a copy is made instead.
> If it improves readability, I can change it into an construction of a new vector with explicit type instead of auto.
Yeah, i missed totally missed that.

Even something like auto Children(Node->getChildren()) would be more obvious (if it works :P)


https://reviews.llvm.org/D38331





More information about the llvm-commits mailing list