[PATCH] D127874: [analyzer] Reimplement UnreachableCodeChecker using worklists

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 7 04:19:51 PDT 2022


steakhal added a comment.

In D127874#3628112 <https://reviews.llvm.org/D127874#3628112>, @martong wrote:

>> I don't think any of the issues mentioned in this patch relates to strongly connected components, thus I don't think I can answer to this question.
>
> In your example above, repeated here:
>
>   #6(entry)      #2(goto a;)
>    |              |        ^
>   #5(goto end;)   |         \
>    |             #4(goto b;) |
>   #1(end:)        |          |
>    |             #3(goto c;) |
>   #0(exit)         \________/
>
> [#2, #4, #3] is a strongly connected (and unreachable) component  of the CFG, isn't it?

Right; those three blocks are unreachable in the CFG.

Let me clarify that this (previous) example has nothing to do with the visitation order. For that, yes either BFS and DFS order would work.
The `magic_clamp` example supposed to underpin the rationale behind choosing BFS instead of DFS.
In the summary, you will find a step-by-step playthrough how the DFS visitation worked previously, and resulted in falsely leaving `B3` and `B5` unreachable due to the order in which their predecessor nodes were visited. Let me know if it helped.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127874



More information about the cfe-commits mailing list