summaryrefslogtreecommitdiff
path: root/test/wasm2js/br_table_to_loop.2asm.js.opt
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-05-09 11:17:18 -0700
committerGitHub <noreply@github.com>2023-05-09 11:17:18 -0700
commitee738ac1f838a090cac74ba8981e2104b6c02d44 (patch)
tree24fb80f961eacb64cee9e29c07189a899ed400ae /test/wasm2js/br_table_to_loop.2asm.js.opt
parentfbe1ed616fd91aae781f7cfbce027d91114f78e5 (diff)
downloadbinaryen-ee738ac1f838a090cac74ba8981e2104b6c02d44.tar.gz
binaryen-ee738ac1f838a090cac74ba8981e2104b6c02d44.tar.bz2
binaryen-ee738ac1f838a090cac74ba8981e2104b6c02d44.zip
Remove TypeUpdater in Vacuum and always ReFinalize (#5707)
TypeUpdater::remove must be called after removing a thing from the tree. If not, then we can get confused by something like this: (block $b (br $b) ) If we first call TypeUpdater::remove then we see that the block's only br is going away, so it becomes unreachable. But when we then remove the br then the block should have type none. Removing the br first from the IR, and then calling TypeUpdater::remove, is the safe way to do it. However, changing that order in Vacuum is not trivial. After looking into this, I realized that it is just simpler to remove TypeUpdater entirely. Instead, we can ReFinalize at the end unconditionally. This has the downside that we do not propagate type updates "as we go", but that should be very rare. Another downside is that TypeUpdater tracks the number of brs, which can help remove code like in the one test that regresses here (see comment there). But I'm not sure that removal was valid - Vacuum should not really be doing it, and it looks like its related to this bug actually. Instead, we have a dedicated pass for removing unused brs - RemoveUnusedBrs - so leave things for it. This PR's benefit, aside from now handling the fuzz testcase, is that it makes the code simpler and faster. I see a 10-25% speedup on the Vacuum pass on various binaries I tested on. (Vacuum is one of our faster passes anyhow, though, so the runtime of -O1 is not much improved.) Another minor benefit might be that running ReFinalize more often can propagate type info more quickly, thanks to #5704 etc. But that is probably very minor.
Diffstat (limited to 'test/wasm2js/br_table_to_loop.2asm.js.opt')
0 files changed, 0 insertions, 0 deletions