diff options
author | Thomas Lively <tlively@google.com> | 2024-11-18 15:28:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-18 15:28:29 -0800 |
commit | 08b7496306915dbe11030a7a4cf79207f9460d2f (patch) | |
tree | 0419bf59e0e557e59198f413d8973537efed0437 /src/passes/Outlining.cpp | |
parent | 69591ded5acab404cba96af7ebc1afd54034c545 (diff) | |
download | binaryen-08b7496306915dbe11030a7a4cf79207f9460d2f.tar.gz binaryen-08b7496306915dbe11030a7a4cf79207f9460d2f.tar.bz2 binaryen-08b7496306915dbe11030a7a4cf79207f9460d2f.zip |
[NFC] Finalize blocks with explicit breakability in IRBuilder (#7085)
Since IRBuilder already knows what labels are used by branches, it is
easy for it to pass that information when finalizing blocks. This avoids
finalization having to walk the blocks looking for branches, speeding up
a future version of the binary parser that uses IRBuilder by 10%.
Diffstat (limited to 'src/passes/Outlining.cpp')
-rw-r--r-- | src/passes/Outlining.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/passes/Outlining.cpp b/src/passes/Outlining.cpp index 429511557..b86e6cd17 100644 --- a/src/passes/Outlining.cpp +++ b/src/passes/Outlining.cpp @@ -304,6 +304,14 @@ struct Outlining : public Pass { // Position the outlined functions first in the functions vector to make // the outlining lit tests far more readable. moveOutlinedFunctions(module, substrings.size()); + + // Because we visit control flow in stringified order rather than normal + // postorder, IRBuilder is not able to properly track branches, so it may + // not have finalized blocks with the correct types. ReFinalize now to fix + // any issues. + PassRunner runner(getPassRunner()); + runner.add(std::make_unique<ReFinalize>()); + runner.run(); } Name addOutlinedFunction(Module* module, |