diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/passes/optimize-instructions-gc.wast | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast index e973ca086..4535a53b3 100644 --- a/test/lit/passes/optimize-instructions-gc.wast +++ b/test/lit/passes/optimize-instructions-gc.wast @@ -38,6 +38,9 @@ (type $void2 (func_subtype $void)) + ;; CHECK: (type $struct_i64 (func (param structref) (result i64))) + (type $struct_i64 (func (param (ref null struct)) (result i64))) + ;; CHECK: (import "env" "get-i32" (func $get-i32 (result i32))) (import "env" "get-i32" (func $get-i32 (result i32))) @@ -2455,4 +2458,45 @@ ) ) ) + + ;; CHECK: (func $gc_to_unreachable_in_added_constants (type $void) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.wrap_i64 + ;; CHECK-NEXT: (i64.add + ;; CHECK-NEXT: (call $struct_i64_helper + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $gc_to_unreachable_in_added_constants + (drop + (i32.wrap_i64 + (i64.add + (i64.const 1) + (i64.add + (i64.const 1) + (call_ref $struct_i64 + ;; This will turn into an unreachable. That should not cause an + ;; error in later i64 add optimizations (optimizeAddedConstants), + ;; which should not assume this is an i64-typed expression. + (ref.as_non_null + (ref.null none) + ) + (ref.func $struct_i64_helper) + ) + ) + ) + ) + ) + ) + + ;; CHECK: (func $struct_i64_helper (type $struct_i64) (param $0 structref) (result i64) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + (func $struct_i64_helper (type $struct_i64) (param $0 (ref null struct)) (result i64) + (unreachable) + ) ) |