diff options
author | Alon Zakai <azakai@google.com> | 2024-10-10 08:40:24 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-10 08:40:24 -0700 |
commit | a8aa6602cdbedd04e69d362c01bbf378a44b395d (patch) | |
tree | 3cd354b15045a2bc69eca26892562947ea917f4e /src/wasm-io.h | |
parent | debd24681cb4764e75936dd74bc33c41899b8a23 (diff) | |
download | binaryen-a8aa6602cdbedd04e69d362c01bbf378a44b395d.tar.gz binaryen-a8aa6602cdbedd04e69d362c01bbf378a44b395d.tar.bz2 binaryen-a8aa6602cdbedd04e69d362c01bbf378a44b395d.zip |
ReFinalize in MergeBlocks so we can optimize unreachable instructions too (#6994)
In #6984 we optimized dropped blocks even if they had unreachable code. In #6988
that part was reverted, and blocks with unreachable code were ignored once more.
However, I realized that the check was not actually for unreachable code, but for
having an unreachable child, so it would miss things like this:
(block
(block
..
(br $somewhere) ;; unreachable type, but no unreachable code
)
)
But it is useful to merge such blocks: we don't need the inner block here.
To fix this, just run ReFinalize if we change anything, which will propagate
unreachability as needed. I think MergeBlocks was written before we had
that utility, so it didn't use it...
This is not only useful for itself but will unblock an EH optimization in a
later PR, that has code in this form. It also simplifies the code by removing
the hasUnreachableChild checks.
Diffstat (limited to 'src/wasm-io.h')
0 files changed, 0 insertions, 0 deletions