diff options
author | Alon Zakai <azakai@google.com> | 2021-02-18 23:54:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-18 15:54:04 -0800 |
commit | 3e31f4fd583324ad446fb96bc0d073e141157f7f (patch) | |
tree | f1569459bda0897593b5491505a7fbd0ac26ee44 /src | |
parent | ad0c8b4fd3808755fc071d43ebaa582a46d74922 (diff) | |
download | binaryen-3e31f4fd583324ad446fb96bc0d073e141157f7f.tar.gz binaryen-3e31f4fd583324ad446fb96bc0d073e141157f7f.tar.bz2 binaryen-3e31f4fd583324ad446fb96bc0d073e141157f7f.zip |
[Wasm Exceptions] Handle delegation to the caller in RemoveUnusedNames (#3585)
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/RemoveUnusedNames.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/passes/RemoveUnusedNames.cpp b/src/passes/RemoveUnusedNames.cpp index addd4367b..a08cb5eda 100644 --- a/src/passes/RemoveUnusedNames.cpp +++ b/src/passes/RemoveUnusedNames.cpp @@ -21,6 +21,7 @@ #include <ir/branch-utils.h> #include <pass.h> +#include <shared-constants.h> #include <wasm.h> namespace wasm { @@ -85,7 +86,11 @@ struct RemoveUnusedNames visitExpression(curr); } - void visitFunction(Function* curr) { assert(branchesSeen.empty()); } + void visitFunction(Function* curr) { + // When we reach the function body we can erase delegations to the caller. + branchesSeen.erase(DELEGATE_CALLER_TARGET); + assert(branchesSeen.empty()); + } }; Pass* createRemoveUnusedNamesPass() { return new RemoveUnusedNames(); } |