diff options
author | Heejin Ahn <aheejin@gmail.com> | 2020-06-03 00:12:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 00:12:15 -0700 |
commit | 501b0a08fafd2b4d2fbb5dd6a4320641bfc823b1 (patch) | |
tree | 9f3ea2e81941baa532818e53a5a8bc1ac19a97d5 /test/wasm2js/dynamicLibrary.2asm.js.opt | |
parent | 3c4630bbe90752c7c720da4ad3805808852b8566 (diff) | |
download | binaryen-501b0a08fafd2b4d2fbb5dd6a4320641bfc823b1.tar.gz binaryen-501b0a08fafd2b4d2fbb5dd6a4320641bfc823b1.tar.bz2 binaryen-501b0a08fafd2b4d2fbb5dd6a4320641bfc823b1.zip |
Prevent pops from sinking in SimplifyLocals (#2885)
This prevents `exnref.pop`s from being sinked and separated from
`catch`. For example,
```wast
(try
(do)
(catch
(local.set $0 (exnref.pop))
(call $foo
(i32.const 3)
(local.get $0)
)
)
)
```
Here, if we sink `exnref.pop` to remove `local.set $0` and
`local.get $0`, it becomes this:
```wast
(try
(do)
(catch
(nop)
(call $foo
(i32.const 3)
(exnref.pop)
)
)
)
```
This move was possible because `i32.const 3` does not have any side
effects. But this is incorrect because now `exnref.pop` does not follow
right after `catch`.
To prevent this, this patch checks this case in `canSink` in
SimplifyLocals. When we encountered a similar case in CodeFolding, we
prevented every expression that contains `Pop` anywhere in it from being
moved, which was too conservative. This adds `danglingPop` property in
`EffectAnalyzer`, so that only pops that are not enclosed within a
`catch` count as 'dangling pops` and we only prevent those pops from
being moved or sinked.
Diffstat (limited to 'test/wasm2js/dynamicLibrary.2asm.js.opt')
0 files changed, 0 insertions, 0 deletions