summaryrefslogtreecommitdiff
path: root/test/lit/passes/vacuum-gc.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/passes/vacuum-gc.wast')
-rw-r--r--test/lit/passes/vacuum-gc.wast27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/lit/passes/vacuum-gc.wast b/test/lit/passes/vacuum-gc.wast
index 8ca40bee8..f37085406 100644
--- a/test/lit/passes/vacuum-gc.wast
+++ b/test/lit/passes/vacuum-gc.wast
@@ -2,6 +2,8 @@
;; RUN: wasm-opt %s --vacuum -all -S -o - | filecheck %s
(module
+ (type ${} (struct))
+
;; CHECK: (func $drop-ref-as (param $x anyref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.as_non_null
@@ -48,4 +50,29 @@
)
)
)
+
+ ;; CHECK: (func $vacuum-rtt-with-depth
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
+ (func $vacuum-rtt-with-depth
+ (drop
+ (if (result (rtt 1 ${}))
+ (i32.const 1)
+ ;; This block's result is not used. As a consequence vacuum will try to
+ ;; generate a replacement zero for the block's fallthrough value. An rtt
+ ;; with depth is a problem for that, since we can't just create an
+ ;; rtt.canon - we'd need to add some rtt.subs, and it's not clear that we'd
+ ;; be improving code size while doing so, hence we do not allow making a
+ ;; zero of that type. Vacuum should not error on trying to do so. And
+ ;; the end result of this function should simply be empty, as everything
+ ;; here can be vacuumed away.
+ (block (result (rtt 1 ${}))
+ (rtt.sub ${}
+ (rtt.canon ${})
+ )
+ )
+ (unreachable)
+ )
+ )
+ )
)