summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-07-22 15:16:04 -0700
committerGitHub <noreply@github.com>2021-07-22 15:16:04 -0700
commit90545189ce4f790c798e83c1e65afb70f228d176 (patch)
tree738008e5ba99ffebee78db4fb9c1d5f7b27b0cea /src
parentf01fd8cad1cb1a6a80ef12bcfc19502bd51ddf46 (diff)
downloadbinaryen-90545189ce4f790c798e83c1e65afb70f228d176.tar.gz
binaryen-90545189ce4f790c798e83c1e65afb70f228d176.tar.bz2
binaryen-90545189ce4f790c798e83c1e65afb70f228d176.zip
Reduce more carefully when it looks like we are failing (#3996)
Instead of skipping to the end, move quickly towards the end. This is sometimes more efficient (as jumping from a big factor to a factor of 1 can skip over big opportunities to remove code all at once instead of once instruction at a time).
Diffstat (limited to 'src')
-rw-r--r--src/tools/wasm-reduce.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp
index 747b93b95..b36891d5b 100644
--- a/src/tools/wasm-reduce.cpp
+++ b/src/tools/wasm-reduce.cpp
@@ -1075,7 +1075,7 @@ struct Reducer
if (WasmValidator().validate(
*module, WasmValidator::Globally | WasmValidator::Quiet) &&
writeAndTestReduction()) {
- std::cerr << "| removed " << names.size() << " functions\n";
+ std::cerr << "| removed " << names.size() << " functions\n";
return true;
} else {
loadWorking(); // restore it from orbit
@@ -1383,8 +1383,8 @@ int main(int argc, const char* argv[]) {
// stop
stopping = true;
} else {
- // just try to remove all we can and finish up
- factor = 1;
+ // decrease the factor quickly
+ factor = (factor + 1) / 2; // stable on 1
}
}
lastPostPassesSize = newSize;