diff options
author | Alon Zakai <azakai@google.com> | 2024-02-27 13:58:34 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-27 13:58:34 -0800 |
commit | a1afe47ed4c3f05bb531bf957a8d7cca978c5feb (patch) | |
tree | dfda4f87f10e37380c510d6e0da0de57a6f491ec /CHANGELOG.md | |
parent | d5157e0fda52e09f7daccce17cd517129b9bf67a (diff) | |
download | binaryen-a1afe47ed4c3f05bb531bf957a8d7cca978c5feb.tar.gz binaryen-a1afe47ed4c3f05bb531bf957a8d7cca978c5feb.tar.bz2 binaryen-a1afe47ed4c3f05bb531bf957a8d7cca978c5feb.zip |
Fuzzer: Separate arguments used to make the fuzz wasm from the opts we run on it (#6357)
Before FUZZ_OPTS was used both when doing --translate-to-fuzz/-ttf to generate the
wasm from the random bytes and also when later running optimizations to generate
a second wasm file for comparison. That is, we ended up doing this, if the opts were -O3:
wasm-opt random.input -ttf -o a.wasm -O3
wasm-opt a.wasm -O3 -o b.wasm
Now we have a pair a.wasm,b.wasm which we can test. However, we have run -O3
on both which is a little silly - the second -O3 might not actually have anything left
to do, which would mean we compare the same wasm to itself.
Worse, this is incorrect, as there are things we need to do only during the
generation phase, like --denan. We need that in order to generate a valid wasm to
test on, but it is "destructive" in itself: when removing NaNs (to avoid nondeterminism)
if replaces them with 0, which is different. As a result, running --denan when
generating the second wasm from the first could lead to different execution in them.
This was always a problem, but became more noticable recently now that DeNaN
modifies SIMD operations, as one optimization we do is to replace a memory.copy
with v128.load + v128.store, and --denan will make sure the loaded value has no
NaNs...
To fix this, separate the generation and optimization phase. Instead of
wasm-opt random.input -ttf -o a.wasm --denan -O3
wasm-opt a.wasm --denan -O3 -o b.wasm
(note how --denan -O3 appears twice), do this:
wasm-opt random.input -ttf -o a.wasm --denan
wasm-opt a.wasm -O3 -o b.wasm
(note how --denan appears in generation, and -O3 in optimization).
Diffstat (limited to 'CHANGELOG.md')
0 files changed, 0 insertions, 0 deletions