binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

[NFC] Add a lazy mode to LocalGraph

Open kripken opened this issue 5 months ago • 1 comments

LocalGraph by default will compute all the local.sets that can be read from all local.gets. However, many passes only query a small amount of those. To avoid wasted work, add a lazy mode that only computes sets when asked about a get.

This is then used in a single place, LoopInvariantCodeMotion, which becomes 18% faster. Later PRs will use it in more places.

The surgery to LocalGraph.cpp is NFC in that it just splits up the main flow() function into prepareFlowBlocks(), which we also run in lazy mode, and flow() which does the eager (non-lazy) flow. All the movement of code is just to get stuff out of the old flow() into the class scope for that purpose. No changes are made to the algorithm. Diff without whitespace is slightly smaller.

kripken avatar Aug 28 '24 18:08 kripken