summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-04-28 09:51:14 -0700
committerGitHub <noreply@github.com>2020-04-28 09:51:14 -0700
commitd8f9e9635ca7ca31d3dc02f3030c9fdaa453f967 (patch)
treebbd58efb78e0a709574bfecca9e6fdb881de7bae
parentd9ec300d178d68f0a1dca587fa6f8f66e74acfae (diff)
downloadbinaryen-d8f9e9635ca7ca31d3dc02f3030c9fdaa453f967.tar.gz
binaryen-d8f9e9635ca7ca31d3dc02f3030c9fdaa453f967.tar.bz2
binaryen-d8f9e9635ca7ca31d3dc02f3030c9fdaa453f967.zip
Use --detect-features in wasm-reduce. Fixes #2813 (#2815)
-rwxr-xr-xcheck.py6
-rw-r--r--src/tools/wasm-reduce.cpp8
2 files changed, 5 insertions, 9 deletions
diff --git a/check.py b/check.py
index 770f483b5..b12d7c2ac 100755
--- a/check.py
+++ b/check.py
@@ -169,7 +169,7 @@ def run_wasm_reduce_tests():
print('..', os.path.basename(t))
# convert to wasm
support.run_command(shared.WASM_AS + [t, '-o', 'a.wasm'])
- support.run_command(shared.WASM_REDUCE + ['a.wasm', '--command=%s b.wasm --fuzz-exec -all' % shared.WASM_OPT[0], '-t', 'b.wasm', '-w', 'c.wasm', '--timeout=4'])
+ support.run_command(shared.WASM_REDUCE + ['a.wasm', '--command=%s b.wasm --fuzz-exec --detect-features ' % shared.WASM_OPT[0], '-t', 'b.wasm', '-w', 'c.wasm', '--timeout=4'])
expected = t + '.txt'
support.run_command(shared.WASM_DIS + ['c.wasm', '-o', 'a.wat'])
with open('a.wat') as seen:
@@ -180,9 +180,9 @@ def run_wasm_reduce_tests():
if 'fsanitize=thread' not in str(os.environ):
print('\n[ checking wasm-reduce fuzz testcase ]\n')
# TODO: re-enable multivalue once it is better optimized
- support.run_command(shared.WASM_OPT + [os.path.join(shared.options.binaryen_test, 'signext.wast'), '-ttf', '-Os', '-o', 'a.wasm', '-all', '--disable-multivalue'])
+ support.run_command(shared.WASM_OPT + [os.path.join(shared.options.binaryen_test, 'signext.wast'), '-ttf', '-Os', '-o', 'a.wasm', '--detect-features', '--disable-multivalue'])
before = os.stat('a.wasm').st_size
- support.run_command(shared.WASM_REDUCE + ['a.wasm', '--command=%s b.wasm --fuzz-exec -all' % shared.WASM_OPT[0], '-t', 'b.wasm', '-w', 'c.wasm'])
+ support.run_command(shared.WASM_REDUCE + ['a.wasm', '--command=%s b.wasm --fuzz-exec --detect-features' % shared.WASM_OPT[0], '-t', 'b.wasm', '-w', 'c.wasm'])
after = os.stat('c.wasm').st_size
# This number is a custom threshold to check if we have shrunk the
# output sufficiently
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp
index 6e6762099..d55dab893 100644
--- a/src/tools/wasm-reduce.cpp
+++ b/src/tools/wasm-reduce.cpp
@@ -282,9 +282,7 @@ struct Reducer
// compensated for), and without
for (auto pass : passes) {
std::string currCommand = Path::getBinaryenBinaryTool("wasm-opt") + " ";
- // TODO(tlively): -all should be replaced with an option to use the
- // existing feature set, once implemented.
- currCommand += working + " -all -o " + test + " " + pass;
+ currCommand += working + " --detect-features -o " + test + " " + pass;
if (debugInfo) {
currCommand += " -g ";
}
@@ -1191,10 +1189,8 @@ int main(int argc, const char* argv[]) {
"(read-written) binary\n";
{
// read and write it
- // TODO(tlively): -all should be replaced with an option to use the existing
- // feature set, once implemented.
auto cmd = Path::getBinaryenBinaryTool("wasm-opt") + " " + input +
- " -all -o " + test;
+ " --detect-features -o " + test;
if (!binary) {
cmd += " -S";
}