summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm-traversal.h1
-rw-r--r--test/passes/dce_all-features.txt11
-rw-r--r--test/passes/dce_all-features.wast11
3 files changed, 23 insertions, 0 deletions
diff --git a/src/wasm-traversal.h b/src/wasm-traversal.h
index 8f4fb5922..16fe87af1 100644
--- a/src/wasm-traversal.h
+++ b/src/wasm-traversal.h
@@ -1075,6 +1075,7 @@ struct PostWalker : public Walker<SubType, VisitorType> {
}
case Expression::Id::PushId: {
self->pushTask(SubType::doVisitPush, currp);
+ self->pushTask(SubType::scan, &curr->cast<Push>()->value);
break;
}
case Expression::Id::PopId: {
diff --git a/test/passes/dce_all-features.txt b/test/passes/dce_all-features.txt
index f9e1b70a4..109f759c2 100644
--- a/test/passes/dce_all-features.txt
+++ b/test/passes/dce_all-features.txt
@@ -532,3 +532,14 @@
)
)
)
+(module
+ (type $FUNCSIG$v (func))
+ (func $foo (; 0 ;) (type $FUNCSIG$v)
+ (nop)
+ )
+ (func $push_unreachable (; 1 ;) (type $FUNCSIG$v)
+ (push
+ (unreachable)
+ )
+ )
+)
diff --git a/test/passes/dce_all-features.wast b/test/passes/dce_all-features.wast
index c6fe0d5d0..cfdc58bbb 100644
--- a/test/passes/dce_all-features.wast
+++ b/test/passes/dce_all-features.wast
@@ -768,3 +768,14 @@
(call $foo) ;; should be dce'd
)
)
+
+;; Push-pop
+(module
+ (func $foo)
+ (func $push_unreachable
+ (push
+ (unreachable)
+ )
+ (call $foo) ;; should be dce'd
+ )
+)