[PATCH] D123784: [clang][analyzer][ctu] Traverse the ctu CallEnter nodes in reverse order

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 6 13:29:54 PDT 2022


martong added a comment.

In D123784#3496981 <https://reviews.llvm.org/D123784#3496981>, @xazax.hun wrote:

> This approach fixes the worklist for the second phase. Would it be possible to create a wrapper that reverses the order of any worklist instead of committing to one and hardcode that?

We don't want to reverse the worklist completely. We could reverse if we want to, by popping all elements and adding them to another queue which has the negated ordering function.

We'd like to have a reversed order only for those nodes that are added to the CTUWorklist during the first phase. In all other cases the normal ordering is the desired. Why? Because we'd like to keep the original algorithm once we are evaluating an inlined foreign function. The only thing we'd like to change is that which foreign function to choose for evaluation next. And we'd like that to be the one that is closer to the root node in the exploded graph (this way the overall path lengths can decrease).

> Would it be possible to create a wrapper that reverses the order of any worklist instead of committing to one and hardcode that?

I don't think this is possible. I mean how could we reverse the DFS, would that be a BFS? The set of the visited nodes might change at the moment when we choose an other node as next. The only way it could work, if we first collect all the nodes that we want to visit. But the graph is being built as we do the visitation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123784



More information about the cfe-commits mailing list