llvm-project
llvm-project copied to clipboard
Block visitation order should account for CFG loops
Currently, we visit blocks in topological order. While better than an arbitrary order, this fails to account for the effects of loops. Namely, that we will visit the successor of a loop before we've reached a fixpoint on a loop, potentially wasting all computation along that path, because of updates resulting from the loop.
Instead, we should use some form of hierarchical ordering, like those discussed in Bourdoncle's Efficient chaotic iteration strategies with widenings](https://citeseerx.ist.psu.edu/doc_view/pid/d885e8dc100cb95bf13cc36c8f0532a3ea4960b1).
We changed the CFG's RPO order to respect loop structure. Benchmarks indicate this resolves all known issues.