summaryrefslogtreecommitdiff
path: root/test/lit/passes/remove-unused-brs-gc.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/passes/remove-unused-brs-gc.wast')
-rw-r--r--test/lit/passes/remove-unused-brs-gc.wast29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/lit/passes/remove-unused-brs-gc.wast b/test/lit/passes/remove-unused-brs-gc.wast
index 0a9e08858..fa7a6d727 100644
--- a/test/lit/passes/remove-unused-brs-gc.wast
+++ b/test/lit/passes/remove-unused-brs-gc.wast
@@ -864,4 +864,33 @@
)
)
)
+
+ ;; CHECK: (func $select-refinalize (type $13) (param $param (ref $struct)) (result (ref struct))
+ ;; CHECK-NEXT: (select (result (ref $struct))
+ ;; CHECK-NEXT: (select (result (ref $struct))
+ ;; CHECK-NEXT: (struct.new_default $struct)
+ ;; CHECK-NEXT: (struct.new_default $struct)
+ ;; CHECK-NEXT: (i32.const 0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $param)
+ ;; CHECK-NEXT: (i32.const 0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $select-refinalize (param $param (ref $struct)) (result (ref struct))
+ ;; The inner if can turn into a select. The type then changes, allowing the
+ ;; outer select to be refined, which will error if we do not refinalize.
+ (select (result (ref struct))
+ (if (result (ref struct))
+ (i32.const 0)
+ (then
+ (struct.new_default $struct)
+ )
+ (else
+ (struct.new_default $struct)
+ )
+ )
+ (local.get $param)
+ (i32.const 0)
+ )
+ )
)