From 459bc0797f67cb2a8fd4598bb7143b34036608d9 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 26 Aug 2024 16:00:45 -0700 Subject: [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. --- src/passes/param-utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/passes/param-utils.h') 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 getUsedParams(Function* func); +std::unordered_set getUsedParams(Function* func, Module* module); // The outcome of an attempt to remove a parameter(s). enum RemovalOutcome { -- cgit v1.2.3