diff options
author | Alon Zakai <azakai@google.com> | 2021-04-20 09:03:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-20 09:03:23 -0700 |
commit | e651186bbdbd36e775236c23f24f0baef1699101 (patch) | |
tree | 13d7bcee1a22e853fa8c1785336a36a4efb2aaee /test/example/module-splitting.cpp | |
parent | 1333d9a31ecacb39643e132400d9409aa3f989be (diff) | |
download | binaryen-e651186bbdbd36e775236c23f24f0baef1699101.tar.gz binaryen-e651186bbdbd36e775236c23f24f0baef1699101.tar.bz2 binaryen-e651186bbdbd36e775236c23f24f0baef1699101.zip |
Implement missing if restructuring (#3819)
The existing restructuring code could turn a block+br_if into an if in
simple cases, but it had some TODOs that I noticed were helpful on
GC benchmarks.
One limitation was that we need to reorder the condition and the value,
(block
(br_if
(value)
(condition)
)
(...)
)
=>
(if
(condition)
(value)
(...)
)
The old code checked for side effects in the condition. But it is ok for it
to have side effects if they can be reordered with the value (for example,
if the value is a constant then it definitely does not care about side effects
in the condition).
The other missing TODO is to use a select when we can't use an if:
(block
(drop
(br_if
(value)
(condition)
)
)
(...)
)
=>
(select
(value)
(...)
(condition)
)
In this case we do not reorder the condition and the value, but we do
reorder the condition with the rest of the block.
Diffstat (limited to 'test/example/module-splitting.cpp')
0 files changed, 0 insertions, 0 deletions