[PATCH] D35918: [GVNHoist] Factor out reachability to search for anticipable instructions quickly

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 13:30:57 PDT 2017


kuhar added a comment.

In https://reviews.llvm.org/D35918#830975, @hiraditya wrote:

> In https://reviews.llvm.org/D35918#829175, @kuhar wrote:
>
> > @dberlin, @hiraditya
> >
> > In https://reviews.llvm.org/D35918#822192, @dberlin wrote:
> >
> > > The graph always has one root, virtual or not.
> > >  Once kuba's latest patch is committed, it will *always* be virtual, actually.
> >
> >
> > That's actually already the case upstream since r309146 (https://reviews.llvm.org/D35597).
> >  https://github.com/llvm-mirror/llvm/blob/22072158f353cc89a7821b13a7c3e99daa5be464/include/llvm/Support/GenericDomTreeConstruction.h#L263
> >  https://github.com/llvm-mirror/llvm/blob/22072158f353cc89a7821b13a7c3e99daa5be464/include/llvm/Support/GenericDomTreeConstruction.h#L307
>
>
> Can you illustrate how to perform a DFS walk on a post-dom tree with your patch. Also, how would I get the (virtual) root node of post-dom tree.
>
> Thanks,


You can get the virtual root by calling PDT.getNode(nullptr). Then you can use something like `llvm/ADT/DepthFirstIterator.h` or `llvm/ADT/PostOrderIterator.h` to run DFS on it. Implementing a custom DFS should also be easy.


https://reviews.llvm.org/D35918





More information about the llvm-commits mailing list