diff options
author | Heejin Ahn <aheejin@gmail.com> | 2021-11-22 11:35:47 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-22 11:35:47 -0800 |
commit | 3c1c8ae829d0026024de55aa65dc3d49bd8fd37a (patch) | |
tree | 9b50791aff53a2438709814b153131a6487061bd /src/wasm/wasm-stack.cpp | |
parent | 587075980d752d6aa819ad0e096d9e15b0568dce (diff) | |
download | binaryen-3c1c8ae829d0026024de55aa65dc3d49bd8fd37a.tar.gz binaryen-3c1c8ae829d0026024de55aa65dc3d49bd8fd37a.tar.bz2 binaryen-3c1c8ae829d0026024de55aa65dc3d49bd8fd37a.zip |
Add fixup function for nested pops in catch (#4348)
This adds `EHUtils::handleBlockNestedPops`, which can be called at the
end of passes that has a possibility to put `pop`s inside `block`s. This
method assumes there exists a `pop` in a first-descendant line, even
though it can be nested within a block. This allows a `pop` to be nested
within a `block` or a `try`, but not a `loop`, since that means the
`pop` can run multile times. In case of `if`, `pop` can exist only in
its condition; if a `pop` is in its true or false body, that's not in
the first-descendant line.
This can be useful when optimization passes create blocks to do
transformations. Wrapping expressions wiith a block does not change
semantics most of the time, but if pops happen to be inside a block
generated by those passes, they can result in invalid binaries.
To test this, this adds `passes/test_passes.cpp`, which is intended to
contain multiple test passes that test a single (or more) utility
functions separately. Without this kind of pass, it is hard to test
various cases in which nested `pop`s can be generated in existing
passes. This PR also adds `PassRegistry::registerTestPass`, which
registers a pass that's intended only for internal testing and does not
show up in `wasm-opt --help`.
Fixes #4237.
Diffstat (limited to 'src/wasm/wasm-stack.cpp')
0 files changed, 0 insertions, 0 deletions