summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/passes/remove-unused-brs_all-features.txt18
-rw-r--r--test/passes/remove-unused-brs_all-features.wast19
2 files changed, 37 insertions, 0 deletions
diff --git a/test/passes/remove-unused-brs_all-features.txt b/test/passes/remove-unused-brs_all-features.txt
new file mode 100644
index 000000000..4bf1cfb33
--- /dev/null
+++ b/test/passes/remove-unused-brs_all-features.txt
@@ -0,0 +1,18 @@
+(module
+ (type $struct (struct (field (ref null $vector))))
+ (type $vector (array (mut i32)))
+ (type $none_=>_ref?|$struct| (func (result (ref null $struct))))
+ (func $foo (result (ref null $struct))
+ (if (result (ref null $struct))
+ (i32.const 1)
+ (struct.new_with_rtt $struct
+ (array.new_default_with_rtt $vector
+ (i32.const 1)
+ (rtt.canon $vector)
+ )
+ (rtt.canon $struct)
+ )
+ (ref.null $struct)
+ )
+ )
+)
diff --git a/test/passes/remove-unused-brs_all-features.wast b/test/passes/remove-unused-brs_all-features.wast
new file mode 100644
index 000000000..4d1a337c6
--- /dev/null
+++ b/test/passes/remove-unused-brs_all-features.wast
@@ -0,0 +1,19 @@
+(module
+ (type $vector (array (mut i32)))
+ (type $struct (struct (field (ref null $vector))))
+ (func $foo (result (ref null $struct))
+ (if (result (ref null $struct))
+ (i32.const 1)
+ (struct.new_with_rtt $struct
+ ;; regression test for computing the cost of an array.new_default, which
+ ;; lacks the optional field "init"
+ (array.new_default_with_rtt $vector
+ (i32.const 1)
+ (rtt.canon $vector)
+ )
+ (rtt.canon $struct)
+ )
+ (ref.null $struct)
+ )
+ )
+)