diff options
-rw-r--r-- | src/passes/Vacuum.cpp | 3 | ||||
-rw-r--r-- | test/passes/vacuum.txt | 5 | ||||
-rw-r--r-- | test/passes/vacuum.wast | 6 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/passes/Vacuum.cpp b/src/passes/Vacuum.cpp index ed868f2f9..12565f603 100644 --- a/src/passes/Vacuum.cpp +++ b/src/passes/Vacuum.cpp @@ -43,7 +43,8 @@ struct Vacuum : public WalkerPass<PostWalker<Vacuum, Visitor<Vacuum>>> { } // if this is an unconditional br, the rest is dead code Break* br = list[z - skip]->dynCast<Break>(); - if (br && !br->condition) { + Switch* sw = list[z - skip]->dynCast<Switch>(); + if ((br && !br->condition) || sw) { list.resize(z - skip + 1); needResize = false; break; diff --git a/test/passes/vacuum.txt b/test/passes/vacuum.txt index a6c7f22f0..103dbc6bc 100644 --- a/test/passes/vacuum.txt +++ b/test/passes/vacuum.txt @@ -11,5 +11,10 @@ (block $waka2 (br $waka2) ) + (block $waka3 + (br_table $waka3 $waka3 $waka3 + (i32.const 57) + ) + ) ) ) diff --git a/test/passes/vacuum.wast b/test/passes/vacuum.wast index dda86804e..a0c638eb8 100644 --- a/test/passes/vacuum.wast +++ b/test/passes/vacuum.wast @@ -17,6 +17,12 @@ (br $waka2) (i32.const 56) ) + (block $waka3 + (br_table $waka3 $waka3 $waka3 + (i32.const 57) + ) + (i32.const 58) + ) ) ) |