binaryen
binaryen copied to clipboard
[NFC] Add a lazy mode to LocalGraph
LocalGraph by default will compute all the local.set
s that can be read from all
local.get
s. 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.