diff options
-rw-r--r-- | src/passes/Vacuum.cpp | 1 | ||||
-rw-r--r-- | test/passes/vacuum_all-features.txt | 3 | ||||
-rw-r--r-- | test/passes/vacuum_all-features.wast | 15 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/passes/Vacuum.cpp b/src/passes/Vacuum.cpp index 9b67a3a16..94537619c 100644 --- a/src/passes/Vacuum.cpp +++ b/src/passes/Vacuum.cpp @@ -423,6 +423,7 @@ struct Vacuum : public WalkerPass<ExpressionStackWalker<Vacuum>> { if (!EffectAnalyzer(getPassOptions(), getModule()->features, curr->body) .throws) { replaceCurrent(curr->body); + typeUpdater.noteRecursiveRemoval(curr->catchBody); } } diff --git a/test/passes/vacuum_all-features.txt b/test/passes/vacuum_all-features.txt index 91a8a8edb..d563d70ed 100644 --- a/test/passes/vacuum_all-features.txt +++ b/test/passes/vacuum_all-features.txt @@ -463,4 +463,7 @@ ) ) ) + (func $br-in-catch + (unreachable) + ) ) diff --git a/test/passes/vacuum_all-features.wast b/test/passes/vacuum_all-features.wast index 98f13dd69..35d6fbd30 100644 --- a/test/passes/vacuum_all-features.wast +++ b/test/passes/vacuum_all-features.wast @@ -824,4 +824,19 @@ ) ) ) + + ;; When catch body is removed, the removal of 'br' inside the catch body + ;; should be propagated up to the outer block, so that its type will be + ;; correctly updated to unreachable. + (func $br-in-catch + (block $label$1 + (try + (unreachable) + (catch + (drop (exnref.pop)) + (br $label$1) + ) + ) + ) + ) ) |