[PATCH] D119571: [funcattrs] use DominatorTree to improve noreturn

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 11 12:30:44 PST 2022


nikic added a comment.

In D119571#3315196 <https://reviews.llvm.org/D119571#3315196>, @nickdesaulniers wrote:

> In D119571#3315181 <https://reviews.llvm.org/D119571#3315181>, @nikic wrote:
>
>> Yes, you'd want to fetch the DominatorTree from the FunctionAnalysisManager. Though as you're only interested in reachability and not actual dominance, you don't actually need a DT here. You can simply walk over the reachable blocks rather than all blocks.
>
> Isn't DominatorTree necessary to compute reachability?

You can traverse all reachable blocks by adding successors to a worklist and checking a visited set. Or as a very lazy way, iterate over `depth_first(F)` or `breath_first(F)`, though those provide additional guarantees not strictly needed here (I don't think we have a helper for plain iteration over reachable blocks).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119571/new/

https://reviews.llvm.org/D119571



More information about the llvm-commits mailing list