[PATCH] D141260: [Dominators] Remove requirement to have NodeRef->getParent(). (WIP)

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 00:51:25 PST 2023


fhahn created this revision.
Herald added subscribers: StephenFan, rogfer01, bollu, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added subscribers: pcwang-thead, vkmr.
Herald added a project: LLVM.

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, let users of DominatorTreeBase directly
define what parent pointer to use and add a ::getParent helper, which
can be specialized.

If there is an easier way to achieve the same result I am missing,
please let me know :)

For the concrete use case, please see D140513 <https://reviews.llvm.org/D140513>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141260

Files:
  llvm/include/llvm/CodeGen/MachineBasicBlock.h
  llvm/include/llvm/IR/BasicBlock.h
  llvm/include/llvm/Support/GenericDomTree.h
  llvm/lib/Transforms/Vectorize/VPlan.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141260.487315.patch
Type: text/x-patch
Size: 4077 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230109/4974d154/attachment.bin>


More information about the llvm-commits mailing list