At the moment, DominatorTreeBase requires NodeRef->getParent to return a
pointer to the container containing all NodeRefs.
This prevents DominatorTreeBase being used for hierarchical structures
where NodeRef can have multiple sub-types, with different parents. This
for example is the case for VPlan, which has region blocks that can be
nested, and regular blocks. NodeRef::getParent() here returns the
containing region. The 'parent' to use for the dominator tree is a VPlan
though, which contains the hierarchical CFG.
To enable such uses cases, allow GraphTraits to provide a custom ParentPtrTy to
directly define what parent pointer to use and add a ::getParent helper, which
can be specialized.
The main motivation for this patch is using DominatorTreeBase across all
regions of a VPlan, see D140513 https://reviews.llvm.org/D140513.
What do you think about making this a little bit more general, say: struct DominatorTreeNodeTraits and moving NodePtr/ParentType/GraphTraits (from D142162) there as well?