[llvm-dev] Access the Post Dominator tree
Momchil Velikov via llvm-dev
llvm-dev at lists.llvm.org
Wed Oct 16 11:18:05 PDT 2019
On Wed, Oct 16, 2019 at 6:43 PM Kaarthik Alagapan via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> I’m trying to access the (post) dominator tree at the SelectionDAG phase
> to get the immediate post dominator block of a branch block. Would the post
> dominator tree be built at before that stage or does it occur after
> building the DAG? If it is, how can I get the post dominator tree of the
> specific block? I’m not able to find a specific function that returns the
> tree other than getNode but that works on a dominator tree.
> Kaarthik A.
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
I'm assuming at SelectionDAG phase you're looking at LLVM IR post-dominator
tree (i.e. not machine one).
There are a few options.
You can state that post-dominace analysis is a prerequisite pass to your
pass in `getAnalysisUsage` and
later obtain it via `auto &PDT =
If it's not a hard requirement, you can check if it's already available
Or you can construct it directly with `auto PDT = std::make_unique<
Once you have the post-dominator tree, you use the `dominates` member
return the post-dominance relation, despite the name.
Mind you, a number of convenience functions are not implemented for
post-dominator tree, look into
`lib/IR/Dominators.cpp` for inspiration how to implement them.
Compiler scrub, Arm.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev