summaryrefslogtreecommitdiff
path: root/src/passes/param-utils.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-08-26 16:00:45 -0700
committerGitHub <noreply@github.com>2024-08-26 16:00:45 -0700
commit459bc0797f67cb2a8fd4598bb7143b34036608d9 (patch)
treeb582f48e4ac61dae6614d7296786fe363f7b82f5 /src/passes/param-utils.h
parent50181145e39304785ccedcd84be9cb7cc428b1f2 (diff)
downloadbinaryen-459bc0797f67cb2a8fd4598bb7143b34036608d9.tar.gz
binaryen-459bc0797f67cb2a8fd4598bb7143b34036608d9.tar.bz2
binaryen-459bc0797f67cb2a8fd4598bb7143b34036608d9.zip
[NFC] Optimize ParamUtils::getUsedParams() (#6866)
This constructed a LocalGraph, which computes the sets that reach each get. But all we need to know is which params are live, so instead we can do a liveness computation (which is just a boolean, not the list of sets). Also, it is simple to get the liveness computation to only work on the parameters and not all the locals, as a further optimization. Existing tests cover this, though I did find that the case of unreachability needed a new test. On a large testcase I am looking at, this makes --dae 17% faster.
Diffstat (limited to 'src/passes/param-utils.h')
-rw-r--r--src/passes/param-utils.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/passes/param-utils.h b/src/passes/param-utils.h
index 4c458390a..35e5d9f80 100644
--- a/src/passes/param-utils.h
+++ b/src/passes/param-utils.h
@@ -42,7 +42,7 @@ namespace wasm::ParamUtils {
// function foo(x) {
// bar(x); // read of a param value
// }
-std::unordered_set<Index> getUsedParams(Function* func);
+std::unordered_set<Index> getUsedParams(Function* func, Module* module);
// The outcome of an attempt to remove a parameter(s).
enum RemovalOutcome {