diff options
author | Alon Zakai <alonzakai@gmail.com> | 2019-02-06 12:59:14 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-06 12:59:14 -0800 |
commit | 4e8c339a5ab327aa896a761fc33fd9ae4be57718 (patch) | |
tree | c986e53af645c55fcc631bf3689ee684e172a369 | |
parent | cc0ccef87716fd8223fc16793c9ec3bc3249da13 (diff) | |
download | binaryen-4e8c339a5ab327aa896a761fc33fd9ae4be57718.tar.gz binaryen-4e8c339a5ab327aa896a761fc33fd9ae4be57718.tar.bz2 binaryen-4e8c339a5ab327aa896a761fc33fd9ae4be57718.zip |
fix printing of unreachable atomics, and add print fuzzing (#1899)
-rw-r--r-- | scripts/fuzz_opt.py | 3 | ||||
-rw-r--r-- | src/passes/Print.cpp | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py index e3a59a690..c8f67b2ae 100644 --- a/scripts/fuzz_opt.py +++ b/scripts/fuzz_opt.py @@ -146,7 +146,7 @@ def test_one(infile, opts): # fuzz vms # gather VM outputs on input file - run([in_bin('wasm-opt'), infile, '-ttf', '--emit-js-wrapper=a.js', '--emit-spec-wrapper=a.wat', '-o', 'a.wasm', '--mvp-features', '--enable-nontrapping-float-to-int']) + run([in_bin('wasm-opt'), infile, '-ttf', '--emit-js-wrapper=a.js', '--emit-spec-wrapper=a.wat', '-o', 'a.wasm', '--mvp-features']) wasm_size = os.stat('a.wasm').st_size bytes += wasm_size print('pre js size :', os.stat('a.js').st_size, ' wasm size:', wasm_size) @@ -202,6 +202,7 @@ opt_choices = [ ["--pick-load-signs"], ["--precompute"], ["--precompute-propagate"], + ["--print"], ["--remove-unused-brs"], ["--remove-unused-nonfunction-module-elements"], ["--remove-unused-module-elements"], diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 761c9e3d4..c511af434 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -206,7 +206,7 @@ struct PrintExpressionContents : public Visitor<PrintExpressionContents> { case Xor: o << "xor"; break; case Xchg: o << "xchg"; break; } - if (curr->bytes != getTypeSize(curr->type)) { + if (curr->type != unreachable && curr->bytes != getTypeSize(curr->type)) { o << "_u"; } restoreNormalColor(o); @@ -218,7 +218,7 @@ struct PrintExpressionContents : public Visitor<PrintExpressionContents> { prepareColor(o); printRMWSize(o, curr->type, curr->bytes); o << "cmpxchg"; - if (curr->bytes != getTypeSize(curr->type)) { + if (curr->type != unreachable && curr->bytes != getTypeSize(curr->type)) { o << "_u"; } restoreNormalColor(o); |