summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/passes/Vacuum.cpp4
-rw-r--r--test/passes/vacuum.txt12
-rw-r--r--test/passes/vacuum.wast30
3 files changed, 46 insertions, 0 deletions
diff --git a/src/passes/Vacuum.cpp b/src/passes/Vacuum.cpp
index 4adfc1289..b58bea4b3 100644
--- a/src/passes/Vacuum.cpp
+++ b/src/passes/Vacuum.cpp
@@ -204,9 +204,13 @@ struct Vacuum : public WalkerPass<PostWalker<Vacuum>> {
Expression* child;
if (value->value.getInteger()) {
child = curr->ifTrue;
+ if (curr->ifFalse) {
+ typeUpdater.noteRecursiveRemoval(curr->ifFalse);
+ }
} else {
if (curr->ifFalse) {
child = curr->ifFalse;
+ typeUpdater.noteRecursiveRemoval(curr->ifTrue);
} else {
ExpressionManipulator::nop(curr);
return;
diff --git a/test/passes/vacuum.txt b/test/passes/vacuum.txt
index 30474280e..cb85838ac 100644
--- a/test/passes/vacuum.txt
+++ b/test/passes/vacuum.txt
@@ -235,4 +235,16 @@
)
)
)
+ (func $executed-if-in-block (type $0)
+ (unreachable)
+ )
+ (func $executed-if-in-block2 (type $0)
+ (unreachable)
+ )
+ (func $executed-if-in-block3 (type $0)
+ (block $label$0
+ (br $label$0)
+ )
+ (unreachable)
+ )
)
diff --git a/test/passes/vacuum.wast b/test/passes/vacuum.wast
index 594554846..2b8486384 100644
--- a/test/passes/vacuum.wast
+++ b/test/passes/vacuum.wast
@@ -534,4 +534,34 @@
(f64.const 2097914503796645752267195e31)
)
)
+ (func $executed-if-in-block
+ (block $label$0
+ (if
+ (i32.const 170996275)
+ (unreachable)
+ (br $label$0)
+ )
+ )
+ (unreachable)
+ )
+ (func $executed-if-in-block2
+ (block $label$0
+ (if
+ (i32.const 170996275)
+ (nop)
+ (br $label$0)
+ )
+ )
+ (unreachable)
+ )
+ (func $executed-if-in-block3
+ (block $label$0
+ (if
+ (i32.const 170996275)
+ (br $label$0)
+ (nop)
+ )
+ )
+ (unreachable)
+ )
)