summaryrefslogtreecommitdiff
path: root/test/lit
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit')
-rw-r--r--test/lit/exec/rtts.wast153
-rw-r--r--test/lit/forward-declared-types.wast26
-rw-r--r--test/lit/fuzz-types/isorecursive.test34
-rw-r--r--test/lit/fuzz-types/nominal.test40
-rw-r--r--test/lit/fuzz-types/structural.test24
-rw-r--r--test/lit/passes/cfp.wast231
-rw-r--r--test/lit/passes/dae-gc.wast30
-rw-r--r--test/lit/passes/gto-removals.wast32
-rw-r--r--test/lit/passes/gufa-refs.wast43
-rw-r--r--test/lit/passes/gufa-vs-cfp.wast233
-rw-r--r--test/lit/passes/heap2local.wast598
-rw-r--r--test/lit/passes/inlining-optimizing.wast4
-rw-r--r--test/lit/passes/inlining_all-features.wast38
-rw-r--r--test/lit/passes/inlining_splitting.wast42
-rw-r--r--test/lit/passes/local-cse_all-features.wast24
-rw-r--r--test/lit/passes/optimize-instructions-call_ref.wast6
-rw-r--r--test/lit/passes/optimize-instructions-gc-iit.wast198
-rw-r--r--test/lit/passes/optimize-instructions-gc.wast293
-rw-r--r--test/lit/passes/optimize-instructions-iit-eh.wast29
-rw-r--r--test/lit/passes/precompute-gc.wast289
-rw-r--r--test/lit/passes/remove-unused-brs-gc.wast32
-rw-r--r--test/lit/passes/roundtrip-gc-types.wast27
-rw-r--r--test/lit/passes/roundtrip-gc.wast20
-rw-r--r--test/lit/passes/vacuum-gc.wast34
24 files changed, 586 insertions, 1894 deletions
diff --git a/test/lit/exec/rtts.wast b/test/lit/exec/rtts.wast
deleted file mode 100644
index 7c090f180..000000000
--- a/test/lit/exec/rtts.wast
+++ /dev/null
@@ -1,153 +0,0 @@
-;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited.
-
-;; Check that allocation and casting instructions with and without RTTs can be
-;; mixed correctly.
-
-;; RUN: wasm-opt %s -all --fuzz-exec-before -q --structural -o /dev/null 2>&1 \
-;; RUN: | filecheck %s --check-prefix=EQREC
-
-;; RUN: wasm-opt %s -all --fuzz-exec-before -q --nominal -o /dev/null 2>&1 \
-;; RUN: | filecheck %s --check-prefix=NOMNL
-
-(module
- (type $struct (struct_subtype i32 data))
- (type $sub-struct (struct_subtype i32 i32 $struct))
-
- (import "fuzzing-support" "log-i32" (func $log (param i32)))
-
- (global $sub-rtt (rtt 1 $sub-struct)
- (rtt.sub $sub-struct
- (rtt.canon $struct)
- )
- )
-
- (func $make-sub-struct-canon (result (ref $struct))
- (struct.new_default_with_rtt $sub-struct
- (rtt.canon $sub-struct)
- )
- )
-
- (func $make-sub-struct-sub (result (ref $struct))
- (struct.new_default_with_rtt $sub-struct
- (global.get $sub-rtt)
- )
- )
-
- (func $make-sub-struct-static (result (ref $struct))
- (struct.new_default $sub-struct)
- )
-
- ;; EQREC: [fuzz-exec] calling canon-canon
- ;; EQREC-NEXT: [LoggingExternalInterface logging 1]
- ;; NOMNL: [fuzz-exec] calling canon-canon
- ;; NOMNL-NEXT: [LoggingExternalInterface logging 1]
- (func "canon-canon"
- (call $log
- (ref.test
- (call $make-sub-struct-canon)
- (rtt.canon $sub-struct)
- )
- )
- )
-
- ;; EQREC: [fuzz-exec] calling canon-sub
- ;; EQREC-NEXT: [LoggingExternalInterface logging 0]
- ;; NOMNL: [fuzz-exec] calling canon-sub
- ;; NOMNL-NEXT: [LoggingExternalInterface logging 1]
- (func "canon-sub"
- (call $log
- (ref.test
- (call $make-sub-struct-canon)
- (global.get $sub-rtt)
- )
- )
- )
-
- ;; EQREC: [fuzz-exec] calling canon-static
- ;; EQREC-NEXT: [LoggingExternalInterface logging 1]
- ;; NOMNL: [fuzz-exec] calling canon-static
- ;; NOMNL-NEXT: [LoggingExternalInterface logging 1]
- (func "canon-static"
- (call $log
- (ref.test_static $sub-struct
- (call $make-sub-struct-canon)
- )
- )
- )
-
- ;; EQREC: [fuzz-exec] calling sub-canon
- ;; EQREC-NEXT: [LoggingExternalInterface logging 0]
- ;; NOMNL: [fuzz-exec] calling sub-canon
- ;; NOMNL-NEXT: [LoggingExternalInterface logging 1]
- (func "sub-canon"
- (call $log
- (ref.test
- (call $make-sub-struct-sub)
- (rtt.canon $sub-struct)
- )
- )
- )
-
- ;; EQREC: [fuzz-exec] calling sub-sub
- ;; EQREC-NEXT: [LoggingExternalInterface logging 1]
- ;; NOMNL: [fuzz-exec] calling sub-sub
- ;; NOMNL-NEXT: [LoggingExternalInterface logging 1]
- (func "sub-sub"
- (call $log
- (ref.test
- (call $make-sub-struct-sub)
- (global.get $sub-rtt)
- )
- )
- )
-
- ;; EQREC: [fuzz-exec] calling sub-static
- ;; EQREC-NEXT: [LoggingExternalInterface logging 0]
- ;; NOMNL: [fuzz-exec] calling sub-static
- ;; NOMNL-NEXT: [LoggingExternalInterface logging 1]
- (func "sub-static"
- (call $log
- (ref.test_static $sub-struct
- (call $make-sub-struct-sub)
- )
- )
- )
-
- ;; EQREC: [fuzz-exec] calling static-canon
- ;; EQREC-NEXT: [LoggingExternalInterface logging 1]
- ;; NOMNL: [fuzz-exec] calling static-canon
- ;; NOMNL-NEXT: [LoggingExternalInterface logging 1]
- (func "static-canon"
- (call $log
- (ref.test
- (call $make-sub-struct-static)
- (rtt.canon $sub-struct)
- )
- )
- )
-
- ;; EQREC: [fuzz-exec] calling static-sub
- ;; EQREC-NEXT: [LoggingExternalInterface logging 0]
- ;; NOMNL: [fuzz-exec] calling static-sub
- ;; NOMNL-NEXT: [LoggingExternalInterface logging 1]
- (func "static-sub"
- (call $log
- (ref.test
- (call $make-sub-struct-static)
- (global.get $sub-rtt)
- )
- )
- )
-
- ;; EQREC: [fuzz-exec] calling static-static
- ;; EQREC-NEXT: [LoggingExternalInterface logging 1]
- ;; NOMNL: [fuzz-exec] calling static-static
- ;; NOMNL-NEXT: [LoggingExternalInterface logging 1]
- (func "static-static"
- (call $log
- (ref.test_static $sub-struct
- (call $make-sub-struct-static)
- )
- )
- )
-)
diff --git a/test/lit/forward-declared-types.wast b/test/lit/forward-declared-types.wast
deleted file mode 100644
index c20cc3a1e..000000000
--- a/test/lit/forward-declared-types.wast
+++ /dev/null
@@ -1,26 +0,0 @@
-;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
-;; Test that types can be used before they are defined
-
-;; RUN: wasm-opt %s -all -S -o - | filecheck %s
-;; RUN: wasm-opt %s -all --nominal -S -o - | filecheck %s --check-prefix=NOMNL
-
-(module
- ;; CHECK: (type $func (func))
-
- ;; CHECK: (type $struct (struct (field (ref $array)) (field (ref null $func))))
- ;; NOMNL: (type $func (func_subtype func))
-
- ;; NOMNL: (type $struct (struct_subtype (field (ref $array)) (field (ref null $func)) data))
- (type $struct (struct
- (field (ref $array))
- (field (ref null $func))
- ))
- ;; CHECK: (type $array (array (rtt 2 $func)))
- ;; NOMNL: (type $array (array_subtype (rtt 2 $func) data))
- (type $array (array (field (rtt 2 $func))))
- (type $func (func))
-
- (func (result (ref null $struct))
- (unreachable)
- )
-)
diff --git a/test/lit/fuzz-types/isorecursive.test b/test/lit/fuzz-types/isorecursive.test
index 78315c5b1..18fade75b 100644
--- a/test/lit/fuzz-types/isorecursive.test
+++ b/test/lit/fuzz-types/isorecursive.test
@@ -2,25 +2,25 @@
;; CHECK: (rec
;; CHECK-NEXT: (type $0 (struct_subtype data))
-;; CHECK-NEXT: (type $1 (func_subtype (param f64) (result f64 i64 f32 (rtt any) f64 f32) func))
-;; CHECK-NEXT: (type $2 (struct_subtype (field f64 v128 (ref null $0) (mut i16) (mut (rtt $5)) (mut (ref null $2))) data))
-;; CHECK-NEXT: (type $3 (struct_subtype (field f64 v128 (ref null $0) (mut i16) (mut (rtt $5)) (mut (ref null $2))) $2))
-;; CHECK-NEXT: (type $4 (struct_subtype (field f64 v128 (ref null $0) (mut i16) (mut (rtt $5)) (mut (ref null $2))) $2))
-;; CHECK-NEXT: (type $5 (struct_subtype (field f64 v128 (ref null $10) (mut i16) (mut (rtt $5)) (mut (ref null $2))) $3))
-;; CHECK-NEXT: (type $6 (struct_subtype (field f64 v128 (ref null $0) (mut i16) (mut (rtt $5)) (mut (ref null $2))) $3))
+;; CHECK-NEXT: (type $1 (func_subtype (param (ref $0)) func))
+;; CHECK-NEXT: (type $2 (struct_subtype (field (mut (ref null $2)) v128 i8 (mut i8) f32) data))
+;; CHECK-NEXT: (type $3 (struct_subtype (field (mut (ref null $2)) v128 i8 (mut i8) f32) $2))
+;; CHECK-NEXT: (type $4 (struct_subtype (field (mut (ref null $2)) v128 i8 (mut i8) f32) $2))
+;; CHECK-NEXT: (type $5 (struct_subtype (field (mut (ref null $2)) v128 i8 (mut i8) f32) $3))
+;; CHECK-NEXT: (type $6 (struct_subtype (field (mut (ref null $2)) v128 i8 (mut i8) f32 v128) $3))
;; CHECK-NEXT: (type $7 (struct_subtype $0))
-;; CHECK-NEXT: (type $8 (struct_subtype (field f32 (mut i16) (ref eq) (mut (rtt $2))) $0))
-;; CHECK-NEXT: (type $9 (struct_subtype (field f64 v128 (ref null $0) (mut i16) (mut (rtt $5)) (mut (ref null $2))) $6))
-;; CHECK-NEXT: (type $10 (struct_subtype (field (ref $2) (mut (ref $13)) (ref null i31) v128 (ref null $6)) $0))
-;; CHECK-NEXT: (type $11 (struct_subtype (field f64 v128 (ref $0) (mut i16) (mut (rtt $5)) (mut (ref null $2))) $2))
+;; CHECK-NEXT: (type $8 (struct_subtype $0))
+;; CHECK-NEXT: (type $9 (struct_subtype (field (mut (ref null $2)) v128 i8 (mut i8) f32 v128) $6))
+;; CHECK-NEXT: (type $10 (struct_subtype (field (mut i64)) $0))
+;; CHECK-NEXT: (type $11 (struct_subtype (field (mut (ref null $2)) v128 i8 (mut i8) f32) $2))
;; CHECK-NEXT: (type $12 (struct_subtype $0))
-;; CHECK-NEXT: (type $13 (struct_subtype (field f64 v128 (ref null $0) (mut i16) (mut (rtt $5)) (mut (ref null $2))) $6))
+;; CHECK-NEXT: (type $13 (struct_subtype (field (mut (ref null $2)) v128 i8 (mut i8) f32 v128) $6))
;; CHECK-NEXT: )
;; CHECK-NEXT: (rec
-;; CHECK-NEXT: (type $14 (struct_subtype (field (ref $2) (mut (ref $13)) i31ref v128 (ref $9) (mut (ref null $10))) $10))
-;; CHECK-NEXT: (type $15 (func_subtype (param f64) (result f64 i64 f32 (rtt any) f64 f32) $1))
-;; CHECK-NEXT: (type $16 (struct_subtype (field f64 v128 (ref null $0) (mut i16) (mut (rtt $5)) (mut (ref null $2))) $2))
-;; CHECK-NEXT: (type $17 (struct_subtype (field (ref $2) (mut (ref $13)) i31ref v128 (ref $9) (mut (ref null $10))) $14))
-;; CHECK-NEXT: (type $18 (struct_subtype $12))
-;; CHECK-NEXT: (type $19 (func_subtype (param f64) (result f64 i64 f32 (rtt any) f64 f32) $15))
+;; CHECK-NEXT: (type $14 (struct_subtype (field (mut i64) (ref null $11) v128) $10))
+;; CHECK-NEXT: (type $15 (func_subtype (param (ref $0)) $1))
+;; CHECK-NEXT: (type $16 (struct_subtype (field (mut (ref null $2)) v128 i8 (mut i8) f32 (mut i64)) $2))
+;; CHECK-NEXT: (type $17 (struct_subtype (field (mut i64) (ref $11) v128 i16 i8) $14))
+;; CHECK-NEXT: (type $18 (struct_subtype (field (mut f64)) $12))
+;; CHECK-NEXT: (type $19 (func_subtype (param (ref $0)) $15))
;; CHECK-NEXT: )
diff --git a/test/lit/fuzz-types/nominal.test b/test/lit/fuzz-types/nominal.test
index 299cf2613..7ef381bfe 100644
--- a/test/lit/fuzz-types/nominal.test
+++ b/test/lit/fuzz-types/nominal.test
@@ -1,22 +1,22 @@
;; RUN: wasm-fuzz-types --nominal -v --seed=0 | filecheck %s
-;; CHECK: (type $0 (struct_subtype (field (ref null $9) (ref $5)) data))
-;; CHECK-NEXT: (type $1 (func_subtype (param (rtt 0 $8)) func))
-;; CHECK-NEXT: (type $2 (struct_subtype (field (mut (rtt $19)) (ref $4)) data))
-;; CHECK-NEXT: (type $3 (struct_subtype (field (mut (rtt $19)) (ref $4) i64 v128 (mut v128)) $2))
-;; CHECK-NEXT: (type $4 (struct_subtype (field (mut (rtt $19)) (ref $4)) $2))
-;; CHECK-NEXT: (type $5 (struct_subtype (field (mut (rtt $19)) (ref $4) i64 v128 (mut v128)) $3))
-;; CHECK-NEXT: (type $6 (struct_subtype (field (mut (rtt $19)) (ref $4) i64 v128 (mut v128)) $3))
-;; CHECK-NEXT: (type $7 (struct_subtype (field (ref null $9) (ref $5)) $0))
-;; CHECK-NEXT: (type $8 (struct_subtype (field (ref null $9) (ref $5)) $0))
-;; CHECK-NEXT: (type $9 (struct_subtype (field (mut (rtt $19)) (ref $4) i64 v128 (mut v128)) $6))
-;; CHECK-NEXT: (type $10 (struct_subtype (field (ref $9) (ref $5) i32) $0))
-;; CHECK-NEXT: (type $11 (struct_subtype (field (mut (rtt $19)) (ref $4) (mut f64) i32 (mut f32)) $2))
-;; CHECK-NEXT: (type $12 (struct_subtype (field (ref null $9) (ref $5)) $0))
-;; CHECK-NEXT: (type $13 (struct_subtype (field (mut (rtt $19)) (ref $4) i64 v128 (mut v128)) $6))
-;; CHECK-NEXT: (type $14 (struct_subtype (field (ref $9) (ref $5) i32) $10))
-;; CHECK-NEXT: (type $15 (func_subtype (param (rtt 0 $8)) $1))
-;; CHECK-NEXT: (type $16 (struct_subtype (field (mut (rtt $19)) (ref $4) (mut i16) i64 (mut (rtt 0 i31))) $2))
-;; CHECK-NEXT: (type $17 (struct_subtype (field (ref $9) (ref $5) i32) $14))
-;; CHECK-NEXT: (type $18 (struct_subtype (field (ref null $9) (ref $5)) $12))
-;; CHECK-NEXT: (type $19 (func_subtype (param (rtt 0 $8)) $15))
+;; CHECK: (type $0 (struct_subtype (field v128 (ref null $4)) data))
+;; CHECK-NEXT: (type $1 (func_subtype (param (ref $3)) (result i32) func))
+;; CHECK-NEXT: (type $2 (struct_subtype (field (mut i64) f64) data))
+;; CHECK-NEXT: (type $3 (struct_subtype (field (mut i64) f64 (mut (ref $12)) i64) $2))
+;; CHECK-NEXT: (type $4 (struct_subtype (field (mut i64) f64) $2))
+;; CHECK-NEXT: (type $5 (struct_subtype (field (mut i64) f64 (mut (ref $12)) i64) $3))
+;; CHECK-NEXT: (type $6 (struct_subtype (field (mut i64) f64 (mut (ref $12)) i64) $3))
+;; CHECK-NEXT: (type $7 (struct_subtype (field v128 (ref null $4)) $0))
+;; CHECK-NEXT: (type $8 (struct_subtype (field v128 (ref $4) (ref null $3) v128) $0))
+;; CHECK-NEXT: (type $9 (struct_subtype (field (mut i64) f64 (mut (ref $12)) i64) $6))
+;; CHECK-NEXT: (type $10 (struct_subtype (field v128 (ref null $4)) $0))
+;; CHECK-NEXT: (type $11 (struct_subtype (field (mut i64) f64) $2))
+;; CHECK-NEXT: (type $12 (struct_subtype (field v128 (ref null $4) (mut (ref null $3))) $0))
+;; CHECK-NEXT: (type $13 (struct_subtype (field (mut i64) f64 (mut (ref $12)) i64) $6))
+;; CHECK-NEXT: (type $14 (struct_subtype (field v128 (ref null $4)) $10))
+;; CHECK-NEXT: (type $15 (func_subtype (param (ref $3)) (result i32) $1))
+;; CHECK-NEXT: (type $16 (struct_subtype (field (mut i64) f64) $2))
+;; CHECK-NEXT: (type $17 (struct_subtype (field v128 (ref null $4) i32) $14))
+;; CHECK-NEXT: (type $18 (struct_subtype (field v128 (ref null $4) (mut (ref null $3)) i16 f64) $12))
+;; CHECK-NEXT: (type $19 (func_subtype (param (ref $3)) (result i32) $15))
diff --git a/test/lit/fuzz-types/structural.test b/test/lit/fuzz-types/structural.test
index e0aa75e9e..345590e2b 100644
--- a/test/lit/fuzz-types/structural.test
+++ b/test/lit/fuzz-types/structural.test
@@ -1,22 +1,22 @@
;; RUN: wasm-fuzz-types --structural -v --seed=0 | filecheck %s
-;; CHECK: (type $0 (struct (field (ref null $3) (ref $3))))
-;; CHECK-NEXT: (type $1 (func (param (rtt 0 $0))))
-;; CHECK-NEXT: (type $2 (struct (field (mut (rtt $1)) (ref $2))))
-;; CHECK-NEXT: (type $3 (struct (field (mut (rtt $1)) (ref $2) i64 v128 (mut v128))))
+;; CHECK: (type $0 (struct (field v128 (ref null $2))))
+;; CHECK-NEXT: (type $1 (func (param (ref $3)) (result i32)))
+;; CHECK-NEXT: (type $2 (struct (field (mut i64) f64)))
+;; CHECK-NEXT: (type $3 (struct (field (mut i64) f64 (mut (ref $12)) i64)))
;; CHECK-NEXT: (type $4 identical to $2)
;; CHECK-NEXT: (type $5 identical to $3)
;; CHECK-NEXT: (type $6 identical to $3)
;; CHECK-NEXT: (type $7 identical to $0)
-;; CHECK-NEXT: (type $8 identical to $0)
+;; CHECK-NEXT: (type $8 (struct (field v128 (ref $2) (ref null $3) v128)))
;; CHECK-NEXT: (type $9 identical to $3)
-;; CHECK-NEXT: (type $10 (struct (field (ref $3) (ref $3) i32)))
-;; CHECK-NEXT: (type $11 (struct (field (mut (rtt $1)) (ref $2) (mut f64) i32 (mut f32))))
-;; CHECK-NEXT: (type $12 identical to $0)
+;; CHECK-NEXT: (type $10 identical to $0)
+;; CHECK-NEXT: (type $11 identical to $2)
+;; CHECK-NEXT: (type $12 (struct (field v128 (ref null $2) (mut (ref null $3)))))
;; CHECK-NEXT: (type $13 identical to $3)
-;; CHECK-NEXT: (type $14 identical to $10)
+;; CHECK-NEXT: (type $14 identical to $0)
;; CHECK-NEXT: (type $15 identical to $1)
-;; CHECK-NEXT: (type $16 (struct (field (mut (rtt $1)) (ref $2) (mut i16) i64 (mut (rtt 0 i31)))))
-;; CHECK-NEXT: (type $17 identical to $10)
-;; CHECK-NEXT: (type $18 identical to $0)
+;; CHECK-NEXT: (type $16 identical to $2)
+;; CHECK-NEXT: (type $17 (struct (field v128 (ref null $2) i32)))
+;; CHECK-NEXT: (type $18 (struct (field v128 (ref null $2) (mut (ref null $3)) i16 f64)))
;; CHECK-NEXT: (type $19 identical to $1)
diff --git a/test/lit/passes/cfp.wast b/test/lit/passes/cfp.wast
index 5caadf16d..782a30af2 100644
--- a/test/lit/passes/cfp.wast
+++ b/test/lit/passes/cfp.wast
@@ -37,9 +37,7 @@
;; CHECK: (func $test (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct
- ;; CHECK-NEXT: (rtt.canon $struct)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i64)
@@ -61,9 +59,7 @@
;; references escaping and being stored etc. - it just thinks at the type
;; level.)
(drop
- (struct.new_default_with_rtt $struct
- (rtt.canon $struct)
- )
+ (struct.new_default $struct)
)
(drop
(struct.get $struct 0
@@ -80,9 +76,8 @@
;; CHECK: (func $test (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (f32.const 42)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
@@ -100,9 +95,8 @@
;; The only place this type is created is with a constant value, and so we
;; can optimize the later get into a constant (plus a drop of the ref).
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(f32.const 42)
- (rtt.canon $struct)
)
)
(drop
@@ -120,9 +114,8 @@
;; CHECK: (func $test (type $f32_=>_none) (param $f f32)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (local.get $f)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
@@ -134,9 +127,8 @@
(func $test (param $f f32)
;; The value given is not a constant, and so we cannot optimize.
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(local.get $f)
- (rtt.canon $struct)
)
)
(drop
@@ -156,17 +148,15 @@
(type $struct (struct i32))
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
)
)
@@ -221,17 +211,15 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
)
)
@@ -246,15 +234,13 @@
;; CHECK: (func $test (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (f32.const 42)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (f32.const 1337)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
@@ -265,15 +251,13 @@
;; CHECK-NEXT: )
(func $test
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(f32.const 42)
- (rtt.canon $struct)
)
)
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(f32.const 1337)
- (rtt.canon $struct)
)
)
(drop
@@ -292,17 +276,15 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (f32.const 42)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(f32.const 42)
- (rtt.canon $struct)
)
)
)
@@ -343,17 +325,15 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (f32.const 42)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(f32.const 42)
- (rtt.canon $struct)
)
)
)
@@ -400,24 +380,22 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (block (result f32)
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: (f32.const 42)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
;; Fall though a 42 via a block.
(block (result f32)
(nop)
(f32.const 42)
)
- (rtt.canon $struct)
)
)
)
@@ -473,9 +451,8 @@
;; CHECK: (func $test (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (ref.func $test)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
@@ -491,9 +468,8 @@
;; CHECK-NEXT: )
(func $test
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(ref.func $test)
- (rtt.canon $struct)
)
)
(drop
@@ -513,9 +489,6 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block ;; (replaces something unreachable we can't emit)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -538,8 +511,7 @@
;; CHECK-NEXT: )
(func $test
(drop
- (struct.new_with_rtt $struct
- (i32.const 10)
+ (struct.new $struct
(unreachable)
)
)
@@ -568,17 +540,15 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
)
)
@@ -615,9 +585,8 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.set $struct 0
@@ -627,9 +596,8 @@
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
)
(struct.set $struct 0
@@ -673,19 +641,17 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $substruct
+ ;; CHECK-NEXT: (struct.new $substruct
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: (f64.const 3.14159)
- ;; CHECK-NEXT: (rtt.canon $substruct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $substruct
+ (struct.new $substruct
(i32.const 10)
(f64.const 3.14159)
- (rtt.canon $substruct)
)
)
)
@@ -722,31 +688,27 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $substruct
+ ;; CHECK-NEXT: (struct.new $substruct
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: (f64.const 3.14159)
- ;; CHECK-NEXT: (rtt.canon $substruct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
)
(drop
- (struct.new_with_rtt $substruct
+ (struct.new $substruct
(i32.const 10)
(f64.const 3.14159)
- (rtt.canon $substruct)
)
)
)
@@ -784,31 +746,27 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $substruct
+ ;; CHECK-NEXT: (struct.new $substruct
;; CHECK-NEXT: (i32.const 20)
;; CHECK-NEXT: (f64.const 3.14159)
- ;; CHECK-NEXT: (rtt.canon $substruct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
)
(drop
- (struct.new_with_rtt $substruct
+ (struct.new $substruct
(i32.const 20)
(f64.const 3.14159)
- (rtt.canon $substruct)
)
)
)
@@ -844,31 +802,27 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $substruct
+ ;; CHECK-NEXT: (struct.new $substruct
;; CHECK-NEXT: (i32.const 20)
;; CHECK-NEXT: (f64.const 3.14159)
- ;; CHECK-NEXT: (rtt.canon $substruct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
)
(drop
- (struct.new_with_rtt $substruct
+ (struct.new $substruct
(i32.const 20)
(f64.const 3.14159)
- (rtt.canon $substruct)
)
)
)
@@ -905,9 +859,8 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.set $struct 0
@@ -915,18 +868,16 @@
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $substruct
+ ;; CHECK-NEXT: (struct.new $substruct
;; CHECK-NEXT: (i32.const 20)
;; CHECK-NEXT: (f64.const 3.14159)
- ;; CHECK-NEXT: (rtt.canon $substruct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
)
(struct.set $struct 0
@@ -934,10 +885,9 @@
(i32.const 10)
)
(drop
- (struct.new_with_rtt $substruct
+ (struct.new $substruct
(i32.const 20)
(f64.const 3.14159)
- (rtt.canon $substruct)
)
)
)
@@ -975,21 +925,19 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct3
+ ;; CHECK-NEXT: (struct.new $struct3
;; CHECK-NEXT: (i32.const 20)
;; CHECK-NEXT: (f64.const 3.14159)
;; CHECK-NEXT: (ref.null any)
- ;; CHECK-NEXT: (rtt.canon $struct3)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct3
+ (struct.new $struct3
(i32.const 20)
(f64.const 3.14159)
(ref.null any)
- (rtt.canon $struct3)
)
)
)
@@ -1114,34 +1062,31 @@
;; CHECK: (func $create (type $anyref_=>_none) (param $any anyref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct1
+ ;; CHECK-NEXT: (struct.new $struct1
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: (i32.const 20)
- ;; CHECK-NEXT: (rtt.canon $struct1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct3
+ ;; CHECK-NEXT: (struct.new $struct3
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: (i32.const 999)
;; CHECK-NEXT: (f64.const 2.71828)
;; CHECK-NEXT: (f64.const 9.9999999)
;; CHECK-NEXT: (ref.null any)
;; CHECK-NEXT: (local.get $any)
- ;; CHECK-NEXT: (rtt.canon $struct3)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create (param $any anyref)
(drop
- (struct.new_with_rtt $struct1
+ (struct.new $struct1
(i32.const 10)
(i32.const 20)
- (rtt.canon $struct1)
)
)
(drop
- (struct.new_with_rtt $struct3
+ (struct.new $struct3
(i32.const 10)
(i32.const 999) ;; use a different value here
(f64.const 2.71828)
@@ -1149,7 +1094,6 @@
(ref.null any)
(local.get $any) ;; use a non-constant value here, which can never be
;; optimized.
- (rtt.canon $struct3)
)
)
)
@@ -1344,47 +1288,41 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct1
+ ;; CHECK-NEXT: (struct.new $struct1
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct2
+ ;; CHECK-NEXT: (struct.new $struct2
;; CHECK-NEXT: (i32.const 9999)
;; CHECK-NEXT: (f64.const 0)
- ;; CHECK-NEXT: (rtt.canon $struct2)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct3
+ ;; CHECK-NEXT: (struct.new $struct3
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: (ref.null any)
- ;; CHECK-NEXT: (rtt.canon $struct3)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct1
+ (struct.new $struct1
(i32.const 10)
- (rtt.canon $struct1)
)
)
(drop
- (struct.new_with_rtt $struct2
+ (struct.new $struct2
(i32.const 9999) ;; use a different value here
(f64.const 0)
- (rtt.canon $struct2)
)
)
(drop
- (struct.new_with_rtt $struct3
+ (struct.new $struct3
(i32.const 10)
(f64.const 0)
(ref.null any)
- (rtt.canon $struct3)
)
)
)
@@ -1447,16 +1385,14 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct1
+ ;; CHECK-NEXT: (struct.new $struct1
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct2
+ ;; CHECK-NEXT: (struct.new $struct2
;; CHECK-NEXT: (i32.const 9999)
;; CHECK-NEXT: (f64.const 0)
- ;; CHECK-NEXT: (rtt.canon $struct2)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.set $struct2 0
@@ -1464,26 +1400,23 @@
;; CHECK-NEXT: (i32.const 9999)
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct3
+ ;; CHECK-NEXT: (struct.new $struct3
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: (ref.null any)
- ;; CHECK-NEXT: (rtt.canon $struct3)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct1
+ (struct.new $struct1
(i32.const 10)
- (rtt.canon $struct1)
)
)
(drop
- (struct.new_with_rtt $struct2
+ (struct.new $struct2
(i32.const 9999) ;; use a different value here
(f64.const 0)
- (rtt.canon $struct2)
)
)
(struct.set $struct2 0
@@ -1492,11 +1425,10 @@
(f64.const 0)
)
(drop
- (struct.new_with_rtt $struct3
+ (struct.new $struct3
(i32.const 10)
(f64.const 0)
(ref.null any)
- (rtt.canon $struct3)
)
)
)
@@ -1547,7 +1479,7 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.eqz
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: )
@@ -1557,19 +1489,17 @@
;; CHECK-NEXT: (f64.const 2.71828)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.const 30)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.eqz (i32.const 10)) ;; not a constant (as far as this pass knows)
(f64.const 3.14159)
(i32.const 20)
(f64.abs (f64.const 2.71828)) ;; not a constant
(i32.const 30)
- (rtt.canon $struct)
)
)
)
@@ -1683,17 +1613,15 @@
;; CHECK: (func $create (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $C
+ ;; CHECK-NEXT: (struct.new $C
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $C)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create
(drop
- (struct.new_with_rtt $C
+ (struct.new $C
(i32.const 10)
- (rtt.canon $C)
)
)
)
@@ -1735,9 +1663,7 @@
;; CHECK: (func $test (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct
- ;; CHECK-NEXT: (rtt.canon $struct)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.set $struct 0
;; CHECK-NEXT: (ref.null $struct)
@@ -1763,9 +1689,7 @@
;; CHECK-NEXT: )
(func $test
(drop
- (struct.new_default_with_rtt $struct
- (rtt.canon $struct)
- )
+ (struct.new_default $struct)
)
;; This copy does not actually introduce any new possible values, and so it
;; remains true that the only possible value is the default.
@@ -1795,9 +1719,7 @@
;; CHECK: (func $test (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct
- ;; CHECK-NEXT: (rtt.canon $struct)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.set $struct 1
;; CHECK-NEXT: (ref.null $struct)
@@ -1816,9 +1738,7 @@
;; CHECK-NEXT: )
(func $test
(drop
- (struct.new_default_with_rtt $struct
- (rtt.canon $struct)
- )
+ (struct.new_default $struct)
)
;; As this is not a copy, we cannot optimize struct.1's get lower down.
(struct.set $struct 1
@@ -1844,9 +1764,7 @@
;; CHECK: (func $test (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct
- ;; CHECK-NEXT: (rtt.canon $struct)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.set $struct 0
;; CHECK-NEXT: (ref.null $struct)
@@ -1867,9 +1785,7 @@
;; CHECK-NEXT: )
(func $test
(drop
- (struct.new_default_with_rtt $struct
- (rtt.canon $struct)
- )
+ (struct.new_default $struct)
)
;; As this is not a copy, we cannot optimize struct.0's get lower down.
(struct.set $struct 0
@@ -2182,4 +2098,3 @@
)
)
)
-
diff --git a/test/lit/passes/dae-gc.wast b/test/lit/passes/dae-gc.wast
index a8e078468..ea4cce506 100644
--- a/test/lit/passes/dae-gc.wast
+++ b/test/lit/passes/dae-gc.wast
@@ -69,30 +69,28 @@
(unreachable)
)
)
- ;; a function that gets an rtt that is never used. we cannot create a local for
- ;; that parameter, as it is not defaultable, so do not remove the parameter.
- ;; CHECK: (func $get-rtt (param $0 (rtt ${}))
+ ;; A function that gets a non-nullable reference that is never used. We can
+ ;; still create a nullable local for that parameter.
+ ;; CHECK: (func $get-nonnull
+ ;; CHECK-NEXT: (local $0 (ref null ${}))
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
- ;; NOMNL: (func $get-rtt (type $rtt_${}_=>_none) (param $0 (rtt ${}))
+ ;; NOMNL: (func $get-nonnull (type $none_=>_none)
+ ;; NOMNL-NEXT: (local $0 (ref null ${}))
;; NOMNL-NEXT: (nop)
;; NOMNL-NEXT: )
- (func $get-rtt (param $0 (rtt ${}))
+ (func $get-nonnull (param $0 (ref ${}))
(nop)
)
- ;; CHECK: (func $send-rtt
- ;; CHECK-NEXT: (call $get-rtt
- ;; CHECK-NEXT: (rtt.canon ${})
- ;; CHECK-NEXT: )
+ ;; CHECK: (func $send-nonnull
+ ;; CHECK-NEXT: (call $get-nonnull)
;; CHECK-NEXT: )
- ;; NOMNL: (func $send-rtt (type $none_=>_none)
- ;; NOMNL-NEXT: (call $get-rtt
- ;; NOMNL-NEXT: (rtt.canon ${})
- ;; NOMNL-NEXT: )
+ ;; NOMNL: (func $send-nonnull (type $none_=>_none)
+ ;; NOMNL-NEXT: (call $get-nonnull)
;; NOMNL-NEXT: )
- (func $send-rtt
- (call $get-rtt
- (rtt.canon ${})
+ (func $send-nonnull
+ (call $get-nonnull
+ (struct.new ${})
)
)
)
diff --git a/test/lit/passes/gto-removals.wast b/test/lit/passes/gto-removals.wast
index 41c7fc950..1bc0d2b73 100644
--- a/test/lit/passes/gto-removals.wast
+++ b/test/lit/passes/gto-removals.wast
@@ -399,8 +399,8 @@
(module
;; A new with side effects
- ;; CHECK: (type $struct (struct_subtype (field i32) (field (rtt $struct)) data))
- (type $struct (struct i32 f64 (ref any) (rtt $struct)))
+ ;; CHECK: (type $struct (struct_subtype (field i32) data))
+ (type $struct (struct i32 f64 (ref any)))
;; CHECK: (type $none_=>_none (func_subtype func))
@@ -425,11 +425,6 @@
;; CHECK-NEXT: (ref.null $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.get $struct 1
- ;; CHECK-NEXT: (ref.null $struct)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $gets (param $x (ref any))
;; Gets to keep certain fields alive.
@@ -438,11 +433,6 @@
(ref.null $struct)
)
)
- (drop
- (struct.get $struct 3
- (ref.null $struct)
- )
- )
)
;; CHECK: (func $new-side-effect (type $none_=>_none)
@@ -468,24 +458,20 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (local.get $0)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $new-side-effect
;; The 2nd&3rd fields here will be removed, since those fields have no
- ;; reads. They has side effects, though, so the operands will be saved in
- ;; locals. Note that we can't save the rtt.canon in locals, but it has
- ;; no effects, and we leave such arguments as they are.
- ;; Note also that one of the fields is non-nullable, and we need to use a
+ ;; reads. They have side effects, though, so the operands will be saved in
+ ;; locals. Note that one of the fields is non-nullable, and we need to use a
;; nullable local for it.
(drop
(struct.new $struct
(call $helper0 (i32.const 0))
(call $helper1 (i32.const 1))
(call $helper2 (i32.const 2))
- (rtt.canon $struct)
)
)
)
@@ -507,7 +493,6 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (global.get $imm-i32)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -522,7 +507,6 @@
(global.get $imm-i32)
(call $helper1 (i32.const 0))
(call $helper2 (i32.const 1))
- (rtt.canon $struct)
)
)
)
@@ -548,7 +532,6 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (local.get $0)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -561,7 +544,6 @@
(global.get $mut-i32)
(call $helper1 (i32.const 0))
(call $helper2 (i32.const 1))
- (rtt.canon $struct)
)
)
)
@@ -580,9 +562,6 @@
;; CHECK-NEXT: (i32.const 3)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -594,7 +573,6 @@
(i32.const 2)
(unreachable)
(call $helper2 (i32.const 3))
- (rtt.canon $struct)
)
)
)
@@ -605,7 +583,6 @@
;; CHECK-NEXT: (call $helper0
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -617,7 +594,6 @@
(call $helper0 (i32.const 0))
(f64.const 3.14159)
(local.get $any)
- (rtt.canon $struct)
)
)
)
diff --git a/test/lit/passes/gufa-refs.wast b/test/lit/passes/gufa-refs.wast
index 19ca922f4..ddd10e7f9 100644
--- a/test/lit/passes/gufa-refs.wast
+++ b/test/lit/passes/gufa-refs.wast
@@ -2896,11 +2896,10 @@
;; they might appear as if no content were possible there, and we'd emit an
;; unreachable. That should not happen anywhere here.
(module
- ;; CHECK: (type $none_=>_none (func_subtype func))
-
- ;; CHECK: (type $A (struct_subtype data))
(type $A (struct_subtype data))
+ ;; CHECK: (type $none_=>_none (func_subtype func))
+
;; CHECK: (type $i32_=>_none (func_subtype (param i32) func))
;; CHECK: (type $B (array_subtype (mut anyref) data))
@@ -3146,44 +3145,6 @@
)
)
- ;; CHECK: (func $refs-rtts (type $none_=>_none)
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.eq
- ;; CHECK-NEXT: (ref.null data)
- ;; CHECK-NEXT: (ref.null data)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result (ref null $A))
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
- ;; CHECK-NEXT: (ref.null $A)
- ;; CHECK-NEXT: (rtt.sub $A
- ;; CHECK-NEXT: (rtt.canon $A)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (ref.null $A)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- (func $refs-rtts
- (drop
- (ref.eq
- (ref.null data)
- (ref.null data)
- )
- )
- (drop
- (ref.cast
- (ref.null $A)
- (rtt.sub $A
- (rtt.canon $A)
- )
- )
- )
- )
-
;; CHECK: (func $table (type $none_=>_none)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (table.get $t
diff --git a/test/lit/passes/gufa-vs-cfp.wast b/test/lit/passes/gufa-vs-cfp.wast
index 38dbf72fd..9cb74fbe7 100644
--- a/test/lit/passes/gufa-vs-cfp.wast
+++ b/test/lit/passes/gufa-vs-cfp.wast
@@ -66,9 +66,7 @@
;; its reference is non-nullable).
(drop
(struct.get $struct 0
- (struct.new_default_with_rtt $struct
- (rtt.canon $struct)
- )
+ (struct.new_default $struct)
)
)
)
@@ -89,9 +87,8 @@
;; passed in, as opposed to being a default value as in the last testcase).
(drop
(struct.get $struct 0
- (struct.new_with_rtt $struct
+ (struct.new $struct
(f32.const 42)
- (rtt.canon $struct)
)
)
)
@@ -112,9 +109,8 @@
;; CHECK: (func $test (type $none_=>_none)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (struct.get $struct 0
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (call $import)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -123,9 +119,8 @@
;; The value given is not a constant, and so we cannot optimize.
(drop
(struct.get $struct 0
- (struct.new_with_rtt $struct
+ (struct.new $struct
(call $import)
- (rtt.canon $struct)
)
)
)
@@ -142,15 +137,13 @@
;; CHECK: (type $none_=>_none (func_subtype func))
;; CHECK: (func $create (type $none_=>_ref|$struct|) (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create (result (ref $struct))
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
)
;; CHECK: (func $get (type $none_=>_none)
@@ -204,15 +197,13 @@
)
;; CHECK: (func $create (type $none_=>_ref|$struct|) (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create (result (ref $struct))
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
)
)
@@ -226,34 +217,30 @@
;; CHECK: (func $test (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (f32.const 42)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (struct.get $struct 0
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (f32.const 1337)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(f32.const 42)
- (rtt.canon $struct)
)
)
;; (A better analysis could see that the first struct.new is dropped and its
;; value cannot reach this struct.get.)
(drop
(struct.get $struct 0
- (struct.new_with_rtt $struct
+ (struct.new $struct
(f32.const 1337)
- (rtt.canon $struct)
)
)
)
@@ -269,15 +256,13 @@
;; CHECK: (type $none_=>_ref|$struct| (func_subtype (result (ref $struct)) func))
;; CHECK: (func $create (type $none_=>_ref|$struct|) (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (f32.const 42)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create (result (ref $struct))
- (struct.new_with_rtt $struct
+ (struct.new $struct
(f32.const 42)
- (rtt.canon $struct)
)
)
;; CHECK: (func $set (type $none_=>_none)
@@ -319,15 +304,13 @@
;; CHECK: (type $none_=>_ref|$struct| (func_subtype (result (ref $struct)) func))
;; CHECK: (func $create (type $none_=>_ref|$struct|) (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (f32.const 42)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create (result (ref $struct))
- (struct.new_with_rtt $struct
+ (struct.new $struct
(f32.const 42)
- (rtt.canon $struct)
)
)
;; CHECK: (func $set (type $none_=>_none)
@@ -376,19 +359,17 @@
(import "a" "b" (func $import (result i32)))
;; CHECK: (func $create (type $none_=>_ref|$struct|) (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (f32.const 42)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create (result (ref $struct))
- (struct.new_with_rtt $struct
+ (struct.new $struct
;; Fall though a 42. The block can be optimized to a constant.
(block $named (result f32)
(nop)
(f32.const 42)
)
- (rtt.canon $struct)
)
)
;; CHECK: (func $set (type $none_=>_none)
@@ -453,9 +434,8 @@
(func $test
(drop
(struct.get $struct 0
- (struct.new_with_rtt $struct
+ (struct.new $struct
(ref.func $test)
- (rtt.canon $struct)
)
)
)
@@ -493,7 +473,7 @@
;; CHECK-NEXT: )
(func $test
(drop
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
(unreachable)
)
@@ -520,15 +500,13 @@
;; CHECK: (type $none_=>_none (func_subtype func))
;; CHECK: (func $create (type $none_=>_ref|$struct|) (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create (result (ref $struct))
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
)
;; CHECK: (func $get (type $none_=>_none)
@@ -569,15 +547,13 @@
;; CHECK: (type $none_=>_ref|$struct| (func_subtype (result (ref $struct)) func))
;; CHECK: (func $create (type $none_=>_ref|$struct|) (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create (result (ref $struct))
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
)
@@ -631,9 +607,8 @@
;; CHECK: (func $test (type $none_=>_none)
;; CHECK-NEXT: (local $ref (ref null $struct))
;; CHECK-NEXT: (local.set $ref
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.set $struct 0
@@ -659,9 +634,8 @@
(func $test
(local $ref (ref null $struct))
(local.set $ref
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
)
(struct.set $struct 0
@@ -700,10 +674,9 @@
(func $test
(drop
(struct.get $struct 0
- (struct.new_with_rtt $substruct
+ (struct.new $substruct
(i32.const 10)
(f64.const 3.14159)
- (rtt.canon $substruct)
)
)
)
@@ -730,14 +703,12 @@
;; CHECK-NEXT: (block (result i32)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (select (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (struct.new_with_rtt $substruct
+ ;; CHECK-NEXT: (struct.new $substruct
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: (f64.const 3.14159)
- ;; CHECK-NEXT: (rtt.canon $substruct)
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $import)
;; CHECK-NEXT: )
@@ -751,14 +722,12 @@
(drop
(struct.get $struct 0
(select
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
- (struct.new_with_rtt $substruct
+ (struct.new $substruct
(i32.const 10)
(f64.const 3.14159)
- (rtt.canon $substruct)
)
(call $import)
)
@@ -787,14 +756,12 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (struct.get $struct 0
;; CHECK-NEXT: (select (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (struct.new_with_rtt $substruct
+ ;; CHECK-NEXT: (struct.new $substruct
;; CHECK-NEXT: (i32.const 20)
;; CHECK-NEXT: (f64.const 3.14159)
- ;; CHECK-NEXT: (rtt.canon $substruct)
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $import)
;; CHECK-NEXT: )
@@ -805,14 +772,12 @@
(drop
(struct.get $struct 0
(select
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
- (struct.new_with_rtt $substruct
+ (struct.new $substruct
(i32.const 20) ;; this constant changed
(f64.const 3.14159)
- (rtt.canon $substruct)
)
(call $import)
)
@@ -846,14 +811,12 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.cast_static $substruct
;; CHECK-NEXT: (select (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (struct.new_with_rtt $substruct
+ ;; CHECK-NEXT: (struct.new $substruct
;; CHECK-NEXT: (i32.const 20)
;; CHECK-NEXT: (f64.const 3.14159)
- ;; CHECK-NEXT: (rtt.canon $substruct)
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $import)
;; CHECK-NEXT: )
@@ -869,14 +832,12 @@
;; This cast is added, ensuring only a $substruct can reach the get.
(ref.cast_static $substruct
(select
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
- (struct.new_with_rtt $substruct
+ (struct.new $substruct
(i32.const 20)
(f64.const 3.14159)
- (rtt.canon $substruct)
)
(call $import)
)
@@ -905,14 +866,12 @@
;; CHECK-NEXT: (local $ref (ref null $struct))
;; CHECK-NEXT: (local.set $ref
;; CHECK-NEXT: (select (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (struct.new_with_rtt $substruct
+ ;; CHECK-NEXT: (struct.new $substruct
;; CHECK-NEXT: (i32.const 20)
;; CHECK-NEXT: (f64.const 3.14159)
- ;; CHECK-NEXT: (rtt.canon $substruct)
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $import)
;; CHECK-NEXT: )
@@ -933,14 +892,12 @@
(local $ref (ref null $struct))
(local.set $ref
(select
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
- (struct.new_with_rtt $substruct
+ (struct.new $substruct
(i32.const 20)
(f64.const 3.14159)
- (rtt.canon $substruct)
)
(call $import)
)
@@ -981,14 +938,12 @@
;; CHECK-NEXT: (local $ref (ref null $struct))
;; CHECK-NEXT: (local.set $ref
;; CHECK-NEXT: (select (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (struct.new_with_rtt $substruct
+ ;; CHECK-NEXT: (struct.new $substruct
;; CHECK-NEXT: (i32.const 20)
;; CHECK-NEXT: (f64.const 3.14159)
- ;; CHECK-NEXT: (rtt.canon $substruct)
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $import)
;; CHECK-NEXT: )
@@ -1014,14 +969,12 @@
(local $ref (ref null $struct))
(local.set $ref
(select
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 10)
- (rtt.canon $struct)
)
- (struct.new_with_rtt $substruct
+ (struct.new $substruct
(i32.const 20)
(f64.const 3.14159)
- (rtt.canon $substruct)
)
(call $import)
)
@@ -1059,19 +1012,17 @@
;; CHECK: (type $none_=>_none (func_subtype func))
;; CHECK: (func $create (type $none_=>_ref|$struct3|) (result (ref $struct3))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct3
+ ;; CHECK-NEXT: (struct.new $struct3
;; CHECK-NEXT: (i32.const 20)
;; CHECK-NEXT: (f64.const 3.14159)
;; CHECK-NEXT: (ref.null any)
- ;; CHECK-NEXT: (rtt.canon $struct3)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create (result (ref $struct3))
- (struct.new_with_rtt $struct3
+ (struct.new $struct3
(i32.const 20)
(f64.const 3.14159)
(ref.null any)
- (rtt.canon $struct3)
)
)
;; CHECK: (func $get (type $none_=>_none)
@@ -1209,33 +1160,30 @@
(import "a" "b" (func $import (result anyref)))
;; CHECK: (func $create1 (type $none_=>_ref|$struct1|) (result (ref $struct1))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct1
+ ;; CHECK-NEXT: (struct.new $struct1
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: (i32.const 20)
- ;; CHECK-NEXT: (rtt.canon $struct1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create1 (result (ref $struct1))
- (struct.new_with_rtt $struct1
+ (struct.new $struct1
(i32.const 10)
(i32.const 20)
- (rtt.canon $struct1)
)
)
;; CHECK: (func $create3 (type $none_=>_ref|$struct3|) (result (ref $struct3))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct3
+ ;; CHECK-NEXT: (struct.new $struct3
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: (i32.const 999)
;; CHECK-NEXT: (f64.const 2.71828)
;; CHECK-NEXT: (f64.const 9.9999999)
;; CHECK-NEXT: (ref.null any)
;; CHECK-NEXT: (call $import)
- ;; CHECK-NEXT: (rtt.canon $struct3)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create3 (result (ref $struct3))
- (struct.new_with_rtt $struct3
+ (struct.new $struct3
(i32.const 10)
(i32.const 999) ;; use a different value here
(f64.const 2.71828)
@@ -1243,7 +1191,6 @@
(ref.null any)
(call $import) ;; use an unknown value here, which can never be
;; optimized.
- (rtt.canon $struct3)
)
)
@@ -1447,47 +1394,41 @@
(import "a" "b" (func $import (result i32)))
;; CHECK: (func $create1 (type $none_=>_ref|$struct1|) (result (ref $struct1))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct1
+ ;; CHECK-NEXT: (struct.new $struct1
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create1 (result (ref $struct1))
- (struct.new_with_rtt $struct1
+ (struct.new $struct1
(i32.const 10)
- (rtt.canon $struct1)
)
)
;; CHECK: (func $create2 (type $none_=>_ref|$struct2|) (result (ref $struct2))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct2
+ ;; CHECK-NEXT: (struct.new $struct2
;; CHECK-NEXT: (i32.const 9999)
;; CHECK-NEXT: (f64.const 0)
- ;; CHECK-NEXT: (rtt.canon $struct2)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create2 (result (ref $struct2))
- (struct.new_with_rtt $struct2
+ (struct.new $struct2
(i32.const 9999) ;; use a different value here
(f64.const 0)
- (rtt.canon $struct2)
)
)
;; CHECK: (func $create3 (type $none_=>_ref|$struct3|) (result (ref $struct3))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct3
+ ;; CHECK-NEXT: (struct.new $struct3
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: (ref.null any)
- ;; CHECK-NEXT: (rtt.canon $struct3)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create3 (result (ref $struct3))
- (struct.new_with_rtt $struct3
+ (struct.new $struct3
(i32.const 10)
(f64.const 0)
(ref.null any)
- (rtt.canon $struct3)
)
)
@@ -1758,47 +1699,41 @@
(import "a" "b" (func $import (result i32)))
;; CHECK: (func $create1 (type $none_=>_ref|$struct1|) (result (ref $struct1))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct1
+ ;; CHECK-NEXT: (struct.new $struct1
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create1 (result (ref $struct1))
- (struct.new_with_rtt $struct1
+ (struct.new $struct1
(i32.const 10)
- (rtt.canon $struct1)
)
)
;; CHECK: (func $create2 (type $none_=>_ref|$struct2|) (result (ref $struct2))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct2
+ ;; CHECK-NEXT: (struct.new $struct2
;; CHECK-NEXT: (i32.const 9999)
;; CHECK-NEXT: (f64.const 0)
- ;; CHECK-NEXT: (rtt.canon $struct2)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create2 (result (ref $struct2))
- (struct.new_with_rtt $struct2
+ (struct.new $struct2
(i32.const 9999) ;; use a different value here
(f64.const 0)
- (rtt.canon $struct2)
)
)
;; CHECK: (func $create3 (type $none_=>_ref|$struct3|) (result (ref $struct3))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct3
+ ;; CHECK-NEXT: (struct.new $struct3
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: (ref.null any)
- ;; CHECK-NEXT: (rtt.canon $struct3)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create3 (result (ref $struct3))
- (struct.new_with_rtt $struct3
+ (struct.new $struct3
(i32.const 10)
(f64.const 0)
(ref.null any)
- (rtt.canon $struct3)
)
)
@@ -1880,47 +1815,41 @@
(import "a" "b" (func $import (result i32)))
;; CHECK: (func $create1 (type $none_=>_ref|$struct1|) (result (ref $struct1))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct1
+ ;; CHECK-NEXT: (struct.new $struct1
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $struct1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create1 (result (ref $struct1))
- (struct.new_with_rtt $struct1
+ (struct.new $struct1
(i32.const 10)
- (rtt.canon $struct1)
)
)
;; CHECK: (func $create2 (type $none_=>_ref|$struct2|) (result (ref $struct2))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct2
+ ;; CHECK-NEXT: (struct.new $struct2
;; CHECK-NEXT: (i32.const 9999)
;; CHECK-NEXT: (f64.const 0)
- ;; CHECK-NEXT: (rtt.canon $struct2)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create2 (result (ref $struct2))
- (struct.new_with_rtt $struct2
+ (struct.new $struct2
(i32.const 9999) ;; use a different value here
(f64.const 0)
- (rtt.canon $struct2)
)
)
;; CHECK: (func $create3 (type $none_=>_ref|$struct3|) (result (ref $struct3))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct3
+ ;; CHECK-NEXT: (struct.new $struct3
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: (ref.null any)
- ;; CHECK-NEXT: (rtt.canon $struct3)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create3 (result (ref $struct3))
- (struct.new_with_rtt $struct3
+ (struct.new $struct3
(i32.const 10)
(f64.const 0)
(ref.null any)
- (rtt.canon $struct3)
)
)
@@ -1988,7 +1917,7 @@
;; CHECK: (type $none_=>_none (func_subtype func))
;; CHECK: (func $create (type $none_=>_ref|$struct|) (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.eqz
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: )
@@ -1998,17 +1927,15 @@
;; CHECK-NEXT: (f64.const 2.71828)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.const 30)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create (result (ref $struct))
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.eqz (i32.const 10)) ;; not a constant (as far as this pass knows)
(f64.const 3.14159)
(i32.const 20)
(f64.abs (f64.const 2.71828)) ;; not a constant
(i32.const 30)
- (rtt.canon $struct)
)
)
;; CHECK: (func $get (type $none_=>_none)
@@ -2110,15 +2037,13 @@
;; CHECK: (type $none_=>_ref|$C| (func_subtype (result (ref $C)) func))
;; CHECK: (func $create-C (type $none_=>_ref|$C|) (result (ref $C))
- ;; CHECK-NEXT: (struct.new_with_rtt $C
+ ;; CHECK-NEXT: (struct.new $C
;; CHECK-NEXT: (i32.const 10)
- ;; CHECK-NEXT: (rtt.canon $C)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $create-C (result (ref $C))
- (struct.new_with_rtt $C
+ (struct.new $C
(i32.const 10)
- (rtt.canon $C)
)
)
;; CHECK: (func $set (type $none_=>_none)
@@ -2167,14 +2092,10 @@
;; CHECK: (type $none_=>_none (func_subtype func))
;; CHECK: (func $create (type $none_=>_ref|$struct|) (result (ref $struct))
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct
- ;; CHECK-NEXT: (rtt.canon $struct)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct)
;; CHECK-NEXT: )
(func $create (result (ref $struct))
- (struct.new_default_with_rtt $struct
- (rtt.canon $struct)
- )
+ (struct.new_default $struct)
)
;; CHECK: (func $test (type $none_=>_none)
diff --git a/test/lit/passes/heap2local.wast b/test/lit/passes/heap2local.wast
index ebe5d1db9..b7ed9bd0f 100644
--- a/test/lit/passes/heap2local.wast
+++ b/test/lit/passes/heap2local.wast
@@ -11,22 +11,20 @@
;; CHECK: (type $struct.recursive (struct (field (mut (ref null $struct.recursive)))))
- ;; CHECK: (type $struct.nonnullable (struct (field (ref $struct.A))))
+ ;; CHECK: (type $struct.nondefaultable (struct (field (ref $struct.A))))
;; CHECK: (type $struct.packed (struct (field (mut i8))))
;; NOMNL: (type $struct.recursive (struct_subtype (field (mut (ref null $struct.recursive))) data))
- ;; NOMNL: (type $struct.nonnullable (struct_subtype (field (ref $struct.A)) data))
-
;; NOMNL: (type $struct.packed (struct_subtype (field (mut i8)) data))
(type $struct.packed (struct (field (mut i8))))
- ;; CHECK: (type $struct.nondefaultable (struct (field (rtt $struct.A))))
- ;; NOMNL: (type $struct.nondefaultable (struct_subtype (field (rtt $struct.A)) data))
- (type $struct.nondefaultable (struct (field (rtt $struct.A))))
+ ;; NOMNL: (type $struct.nondefaultable (struct_subtype (field (ref $struct.A)) data))
+ (type $struct.nondefaultable (struct (field (ref $struct.A))))
(type $struct.recursive (struct (field (mut (ref null $struct.recursive)))))
+ ;; NOMNL: (type $struct.nonnullable (struct_subtype (field (ref $struct.A)) data))
(type $struct.nonnullable (struct (field (ref $struct.A))))
;; CHECK: (func $simple
@@ -40,9 +38,6 @@
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -58,9 +53,6 @@
;; NOMNL-NEXT: (local.set $1
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -69,9 +61,7 @@
;; Other passes can remove such a trivial case of an unused allocation, but
;; we still optimize it.
(drop
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
)
@@ -87,9 +77,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -106,9 +93,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -120,9 +104,7 @@
;; drop (and adding some unnecessary code to allocate the values, which we
;; depend on other passes to remove).
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
)
@@ -139,9 +121,6 @@
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -162,9 +141,6 @@
;; NOMNL-NEXT: (local.set $1
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -180,9 +156,7 @@
;; locals, and we read from the locals instead of the struct.get.
(drop
(struct.get $struct.A 0
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
)
)
@@ -200,9 +174,6 @@
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -223,9 +194,6 @@
;; NOMNL-NEXT: (local.set $1
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -237,9 +205,7 @@
;; Similar to the above, but using a different field index.
(drop
(struct.get $struct.A 1
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
)
)
@@ -255,9 +221,6 @@
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -276,9 +239,6 @@
;; NOMNL-NEXT: (local.set $1
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -289,9 +249,7 @@
(func $one-set
;; A simple optimizable allocation only used in one set.
(struct.set $struct.A 0
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
(i32.const 1)
)
)
@@ -299,18 +257,14 @@
;; CHECK: (func $packed
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (struct.get_u $struct.packed 0
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.packed
- ;; CHECK-NEXT: (rtt.canon $struct.packed)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.packed)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $packed (type $none_=>_none)
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (struct.get_u $struct.packed 0
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.packed
- ;; NOMNL-NEXT: (rtt.canon $struct.packed)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.packed)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -318,9 +272,7 @@
;; We do not optimize packed structs yet.
(drop
(struct.get $struct.packed 0
- (struct.new_default_with_rtt $struct.packed
- (rtt.canon $struct.packed)
- )
+ (struct.new_default $struct.packed)
)
)
)
@@ -346,9 +298,6 @@
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (local.get $3)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -377,9 +326,6 @@
;; NOMNL-NEXT: (local.set $1
;; NOMNL-NEXT: (local.get $3)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -392,10 +338,9 @@
;; proper locals.
(drop
(struct.get $struct.A 0
- (struct.new_with_rtt $struct.A
+ (struct.new $struct.A
(i32.const 2)
(f64.const 3.14159)
- (rtt.canon $struct.A)
)
)
)
@@ -412,9 +357,6 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -431,9 +373,6 @@
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (unreachable)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -444,43 +383,70 @@
;; remove it.
(drop
(struct.get $struct.A 0
- (struct.new_with_rtt $struct.A
+ (struct.new $struct.A
(i32.const 2)
(unreachable)
- (rtt.canon $struct.A)
)
)
)
)
;; CHECK: (func $nondefaultable
+ ;; CHECK-NEXT: (local $0 (ref null $struct.A))
+ ;; CHECK-NEXT: (local $1 (ref null $struct.A))
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.get $struct.nondefaultable 0
- ;; CHECK-NEXT: (struct.new_with_rtt $struct.nondefaultable
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: (rtt.canon $struct.nondefaultable)
+ ;; CHECK-NEXT: (block (result (ref $struct.A))
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (block (result (ref null $struct.nondefaultable))
+ ;; CHECK-NEXT: (local.set $1
+ ;; CHECK-NEXT: (struct.new_default $struct.A)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.set $0
+ ;; CHECK-NEXT: (ref.as_non_null
+ ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (ref.null $struct.nondefaultable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (ref.as_non_null
+ ;; CHECK-NEXT: (local.get $0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $nondefaultable (type $none_=>_none)
+ ;; NOMNL-NEXT: (local $0 (ref null $struct.A))
+ ;; NOMNL-NEXT: (local $1 (ref null $struct.A))
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (struct.get $struct.nondefaultable 0
- ;; NOMNL-NEXT: (struct.new_with_rtt $struct.nondefaultable
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: (rtt.canon $struct.nondefaultable)
+ ;; NOMNL-NEXT: (block (result (ref $struct.A))
+ ;; NOMNL-NEXT: (drop
+ ;; NOMNL-NEXT: (block (result (ref null $struct.nondefaultable))
+ ;; NOMNL-NEXT: (local.set $1
+ ;; NOMNL-NEXT: (struct.new_default $struct.A)
+ ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (local.set $0
+ ;; NOMNL-NEXT: (ref.as_non_null
+ ;; NOMNL-NEXT: (local.get $1)
+ ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (ref.null $struct.nondefaultable)
+ ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (ref.as_non_null
+ ;; NOMNL-NEXT: (local.get $0)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
(func $nondefaultable
;; We do not optimize structs with nondefaultable types that we cannot
- ;; handle, like rtts.
+ ;; handle.
+ ;; TODO: We should be able to handle this after #4824 is resolved.
(drop
(struct.get $struct.nondefaultable 0
- (struct.new_with_rtt $struct.nondefaultable
- (rtt.canon $struct.A)
- (rtt.canon $struct.nondefaultable)
+ (struct.new $struct.nondefaultable
+ (struct.new_default $struct.A)
)
)
)
@@ -498,9 +464,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -525,9 +488,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -546,9 +506,7 @@
;; to a local. The local.set should not prevent our optimization, and the
;; local.set can be turned into a drop.
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(struct.set $struct.A 0
(local.get $ref)
@@ -568,9 +526,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -593,9 +548,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -609,9 +561,7 @@
(func $simple-one-local-get (result f64)
(local $ref (ref null $struct.A))
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
;; A simple optimizable allocation only used in one get, via a local.
(struct.get $struct.A 1
@@ -640,9 +590,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -668,9 +615,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -687,9 +631,7 @@
(func $safe-to-drop (result f64)
(local $ref (ref null $struct.A))
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
;; An extra drop does not let the allocation escape.
(drop
@@ -703,9 +645,7 @@
;; CHECK: (func $escape-via-call (result f64)
;; CHECK-NEXT: (local $ref (ref null $struct.A))
;; CHECK-NEXT: (local.set $ref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.A
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $send-ref
;; CHECK-NEXT: (local.get $ref)
@@ -717,9 +657,7 @@
;; NOMNL: (func $escape-via-call (type $none_=>_f64) (result f64)
;; NOMNL-NEXT: (local $ref (ref null $struct.A))
;; NOMNL-NEXT: (local.set $ref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.A
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (call $send-ref
;; NOMNL-NEXT: (local.get $ref)
@@ -731,9 +669,7 @@
(func $escape-via-call (result f64)
(local $ref (ref null $struct.A))
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
;; The allocation escapes into a call.
(call $send-ref
@@ -756,9 +692,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -788,9 +721,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -811,9 +741,7 @@
(func $safe-to-drop-multiflow (result f64)
(local $ref (ref null $struct.A))
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
;; An extra drop + multiple flows through things do not stop us.
(drop
@@ -833,9 +761,7 @@
;; CHECK: (func $escape-after-multiflow (result f64)
;; CHECK-NEXT: (local $ref (ref null $struct.A))
;; CHECK-NEXT: (local.set $ref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.A
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $send-ref
;; CHECK-NEXT: (block (result (ref null $struct.A))
@@ -851,9 +777,7 @@
;; NOMNL: (func $escape-after-multiflow (type $none_=>_f64) (result f64)
;; NOMNL-NEXT: (local $ref (ref null $struct.A))
;; NOMNL-NEXT: (local.set $ref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.A
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (call $send-ref
;; NOMNL-NEXT: (block (result (ref null $struct.A))
@@ -869,9 +793,7 @@
(func $escape-after-multiflow (result f64)
(local $ref (ref null $struct.A))
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
;; An escape after multiple flows.
(call $send-ref
@@ -892,12 +814,8 @@
;; CHECK-NEXT: (local $ref (ref null $struct.A))
;; CHECK-NEXT: (local.set $ref
;; CHECK-NEXT: (select (result (ref $struct.A))
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.A
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.A
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.A)
+ ;; CHECK-NEXT: (struct.new_default $struct.A)
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -909,12 +827,8 @@
;; NOMNL-NEXT: (local $ref (ref null $struct.A))
;; NOMNL-NEXT: (local.set $ref
;; NOMNL-NEXT: (select (result (ref $struct.A))
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.A
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.A
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.A)
+ ;; NOMNL-NEXT: (struct.new_default $struct.A)
;; NOMNL-NEXT: (i32.const 1)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -928,12 +842,8 @@
;; to optimize it.
(local.set $ref
(select
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
+ (struct.new_default $struct.A)
(i32.const 1)
)
)
@@ -954,9 +864,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -982,9 +889,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -1001,9 +905,7 @@
(func $local-copies (result f64)
(local $ref (ref null $struct.A))
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
;; Copying our allocation through locals does not bother us.
(local.set $ref
@@ -1027,9 +929,6 @@
;; CHECK-NEXT: (local.set $3
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -1066,9 +965,6 @@
;; NOMNL-NEXT: (local.set $3
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -1096,9 +992,7 @@
(local $ref (ref null $struct.A))
(local $ref-2 (ref null $struct.A))
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
;; Copying our allocation through locals does not bother us, even if it's
;; another local.
@@ -1129,9 +1023,6 @@
;; CHECK-NEXT: (local.set $3
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -1160,9 +1051,6 @@
;; NOMNL-NEXT: (local.set $3
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -1182,9 +1070,7 @@
(func $local-copies-conditional (param $x i32) (result f64)
(local $ref (ref null $struct.A))
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
;; Possibly copying our allocation through locals does not bother us. Note
;; that as a result of this the final local.get has two sets that send it
@@ -1211,9 +1097,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -1241,9 +1124,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -1262,9 +1142,7 @@
(func $block-value (result f64)
(local $ref (ref null $struct.A))
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
;; Returning our allocation from a block does not bother us.
(struct.get $struct.A 1
@@ -1281,9 +1159,7 @@
;; CHECK: (func $non-exclusive-get (param $x i32) (result f64)
;; CHECK-NEXT: (local $ref (ref null $struct.A))
;; CHECK-NEXT: (local.set $ref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.A
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: (if
;; CHECK-NEXT: (local.get $x)
@@ -1298,9 +1174,7 @@
;; NOMNL: (func $non-exclusive-get (type $i32_=>_f64) (param $x i32) (result f64)
;; NOMNL-NEXT: (local $ref (ref null $struct.A))
;; NOMNL-NEXT: (local.set $ref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.A
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (if
;; NOMNL-NEXT: (local.get $x)
@@ -1315,9 +1189,7 @@
(func $non-exclusive-get (param $x i32) (result f64)
(local $ref (ref null $struct.A))
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(if (local.get $x)
(local.set $ref
@@ -1343,9 +1215,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -1363,9 +1232,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -1376,9 +1242,7 @@
(struct.get $struct.A 0
;; A tee flows out the value, and we can optimize this allocation.
(local.tee $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
)
)
@@ -1391,9 +1255,6 @@
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (ref.null $struct.recursive)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.recursive)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.recursive)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -1409,9 +1270,6 @@
;; NOMNL-NEXT: (local.set $1
;; NOMNL-NEXT: (ref.null $struct.recursive)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.recursive)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.recursive)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -1424,9 +1282,7 @@
;; As above, but with a set, and also a recursive type.
(struct.set $struct.recursive 0
(local.tee $ref
- (struct.new_default_with_rtt $struct.recursive
- (rtt.canon $struct.recursive)
- )
+ (struct.new_default $struct.recursive)
)
(ref.null $struct.recursive)
)
@@ -1437,9 +1293,7 @@
;; CHECK-NEXT: (struct.set $struct.recursive 0
;; CHECK-NEXT: (ref.null $struct.recursive)
;; CHECK-NEXT: (local.tee $ref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.recursive
- ;; CHECK-NEXT: (rtt.canon $struct.recursive)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.recursive)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -1448,9 +1302,7 @@
;; NOMNL-NEXT: (struct.set $struct.recursive 0
;; NOMNL-NEXT: (ref.null $struct.recursive)
;; NOMNL-NEXT: (local.tee $ref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.recursive
- ;; NOMNL-NEXT: (rtt.canon $struct.recursive)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.recursive)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -1461,9 +1313,7 @@
;; As above, but operands reversed: the allocation is now the value, not
;; the reference, and so it escapes.
(local.tee $ref
- (struct.new_default_with_rtt $struct.recursive
- (rtt.canon $struct.recursive)
- )
+ (struct.new_default $struct.recursive)
)
)
)
@@ -1475,16 +1325,11 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result (ref null $struct.recursive))
;; CHECK-NEXT: (local.set $2
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.recursive
- ;; CHECK-NEXT: (rtt.canon $struct.recursive)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.recursive)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (local.get $2)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.recursive)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.recursive)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -1504,16 +1349,11 @@
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (block (result (ref null $struct.recursive))
;; NOMNL-NEXT: (local.set $2
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.recursive
- ;; NOMNL-NEXT: (rtt.canon $struct.recursive)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.recursive)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $1
;; NOMNL-NEXT: (local.get $2)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.recursive)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.recursive)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -1530,7 +1370,7 @@
(local $0 (ref null $struct.recursive))
(local.set $0
;; The outer allocation can be optimized, as it does not escape.
- (struct.new_with_rtt $struct.recursive
+ (struct.new $struct.recursive
;; The inner allocation should not prevent the outer one from being
;; optimized through some form of confusion.
;; After the outer one is optimized, the inner one can be optimized in
@@ -1538,10 +1378,7 @@
;; on other optimizations to actually remove the outer allocation (like
;; vacuum), and so it cannot be optimized. If we ran vaccum, and then
;; additional iterations, this might be handled.
- (struct.new_default_with_rtt $struct.recursive
- (rtt.canon $struct.recursive)
- )
- (rtt.canon $struct.recursive)
+ (struct.new_default $struct.recursive)
)
)
(drop
@@ -1555,9 +1392,7 @@
;; CHECK-NEXT: (local $ref (ref null $struct.A))
;; CHECK-NEXT: (struct.set $struct.A 0
;; CHECK-NEXT: (local.tee $ref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.A
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
@@ -1567,9 +1402,7 @@
;; NOMNL-NEXT: (local $ref (ref null $struct.A))
;; NOMNL-NEXT: (struct.set $struct.A 0
;; NOMNL-NEXT: (local.tee $ref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.A
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (i32.const 1)
;; NOMNL-NEXT: )
@@ -1579,9 +1412,7 @@
(local $ref (ref null $struct.A))
(struct.set $struct.A 0
(local.tee $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(i32.const 1)
)
@@ -1593,9 +1424,7 @@
;; CHECK-NEXT: (local $ref (ref null $struct.A))
;; CHECK-NEXT: (struct.set $struct.A 0
;; CHECK-NEXT: (local.tee $ref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.A
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
@@ -1607,9 +1436,7 @@
;; NOMNL-NEXT: (local $ref (ref null $struct.A))
;; NOMNL-NEXT: (struct.set $struct.A 0
;; NOMNL-NEXT: (local.tee $ref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.A
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (i32.const 1)
;; NOMNL-NEXT: )
@@ -1621,9 +1448,7 @@
(local $ref (ref null $struct.A))
(struct.set $struct.A 0
(local.tee $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(i32.const 1)
)
@@ -1639,7 +1464,7 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result (ref $struct.A))
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result (ref null $struct.nonnullable))
+ ;; CHECK-NEXT: (block (result (ref null $struct.nondefaultable))
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (local.get $a)
;; CHECK-NEXT: )
@@ -1648,10 +1473,7 @@
;; CHECK-NEXT: (local.get $2)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.nonnullable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (ref.null $struct.nonnullable)
+ ;; CHECK-NEXT: (ref.null $struct.nondefaultable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.as_non_null
@@ -1675,9 +1497,6 @@
;; NOMNL-NEXT: (local.get $2)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.nonnullable)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.nonnullable)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -1692,9 +1511,8 @@
;; An optimizable case where the type is non-nullable, which requires
;; special handling in locals.
(struct.get $struct.nonnullable 0
- (struct.new_with_rtt $struct.nonnullable
+ (struct.new $struct.nonnullable
(local.get $a)
- (rtt.canon $struct.nonnullable)
)
)
)
@@ -1721,9 +1539,6 @@
;; CHECK-NEXT: (local.set $3
;; CHECK-NEXT: (local.get $5)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -1818,9 +1633,6 @@
;; NOMNL-NEXT: (local.set $3
;; NOMNL-NEXT: (local.get $5)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -1900,10 +1712,9 @@
;; in various ways inside.
(loop $outer
(local.set $ref
- (struct.new_with_rtt $struct.A
+ (struct.new $struct.A
(i32.const 2)
(f64.const 2.1828)
- (rtt.canon $struct.A)
)
)
(drop
@@ -1969,9 +1780,6 @@
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -1988,9 +1796,6 @@
;; CHECK-NEXT: (local.set $3
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -2007,9 +1812,6 @@
;; CHECK-NEXT: (local.set $5
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -2034,9 +1836,6 @@
;; NOMNL-NEXT: (local.set $1
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2053,9 +1852,6 @@
;; NOMNL-NEXT: (local.set $3
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2072,9 +1868,6 @@
;; NOMNL-NEXT: (local.set $5
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2086,23 +1879,17 @@
;; Multiple independent things we can optimize.
(drop
(struct.get $struct.A 0
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
)
(drop
(struct.get $struct.A 0
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
)
(drop
(struct.get $struct.A 1
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
)
)
@@ -2121,9 +1908,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -2143,9 +1927,6 @@
;; CHECK-NEXT: (local.set $4
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -2172,9 +1953,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2194,9 +1972,6 @@
;; NOMNL-NEXT: (local.set $4
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2214,9 +1989,7 @@
;; Multiple independent things we can optimize that use the same local
;; index, but they do not conflict in their live ranges.
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(drop
(struct.get $struct.A 0
@@ -2224,9 +1997,7 @@
)
)
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(drop
(struct.get $struct.A 0
@@ -2250,9 +2021,6 @@
;; CHECK-NEXT: (local.set $3
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -2264,9 +2032,6 @@
;; CHECK-NEXT: (local.set $5
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -2302,9 +2067,6 @@
;; NOMNL-NEXT: (local.set $3
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2316,9 +2078,6 @@
;; NOMNL-NEXT: (local.set $5
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2345,14 +2104,10 @@
;; Multiple independent things we can optimize that use different local
;; indexes, but whose lifetimes overlap. We should not be confused by that.
(local.set $ref1
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(local.set $ref2
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(drop
(struct.get $struct.A 0
@@ -2369,9 +2124,7 @@
;; CHECK: (func $get-through-block (result f64)
;; CHECK-NEXT: (local $0 (ref null $struct.A))
;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.A
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.get $struct.A 1
;; CHECK-NEXT: (block $block (result (ref null $struct.A))
@@ -2388,9 +2141,7 @@
;; NOMNL: (func $get-through-block (type $none_=>_f64) (result f64)
;; NOMNL-NEXT: (local $0 (ref null $struct.A))
;; NOMNL-NEXT: (local.set $0
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.A
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (struct.get $struct.A 1
;; NOMNL-NEXT: (block $block (result (ref null $struct.A))
@@ -2407,9 +2158,7 @@
(func $get-through-block (result f64)
(local $0 (ref null $struct.A))
(local.set $0
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(struct.get $struct.A 1
(block $block (result (ref null $struct.A))
@@ -2431,9 +2180,7 @@
;; CHECK: (func $branch-to-block (result f64)
;; CHECK-NEXT: (local $0 (ref null $struct.A))
;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.A
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.get $struct.A 1
;; CHECK-NEXT: (block $block (result (ref null $struct.A))
@@ -2450,9 +2197,7 @@
;; NOMNL: (func $branch-to-block (type $none_=>_f64) (result f64)
;; NOMNL-NEXT: (local $0 (ref null $struct.A))
;; NOMNL-NEXT: (local.set $0
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.A
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (struct.get $struct.A 1
;; NOMNL-NEXT: (block $block (result (ref null $struct.A))
@@ -2469,9 +2214,7 @@
(func $branch-to-block (result f64)
(local $0 (ref null $struct.A))
(local.set $0
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(struct.get $struct.A 1
(block $block (result (ref null $struct.A))
@@ -2500,9 +2243,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -2535,9 +2275,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2561,9 +2298,7 @@
(func $branch-to-block-no-fallthrough (result f64)
(local $0 (ref null $struct.A))
(local.set $0
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(struct.get $struct.A 1
(block $block (result (ref null $struct.A))
@@ -2584,9 +2319,7 @@
;; CHECK: (func $two-branches (result f64)
;; CHECK-NEXT: (local $0 (ref null $struct.A))
;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.A
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.get $struct.A 1
;; CHECK-NEXT: (block $block (result (ref null $struct.A))
@@ -2611,9 +2344,7 @@
;; NOMNL: (func $two-branches (type $none_=>_f64) (result f64)
;; NOMNL-NEXT: (local $0 (ref null $struct.A))
;; NOMNL-NEXT: (local.set $0
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.A
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (struct.get $struct.A 1
;; NOMNL-NEXT: (block $block (result (ref null $struct.A))
@@ -2638,9 +2369,7 @@
(func $two-branches (result f64)
(local $0 (ref null $struct.A))
(local.set $0
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(struct.get $struct.A 1
(block $block (result (ref null $struct.A))
@@ -2666,9 +2395,7 @@
;; CHECK: (func $two-branches-b (result f64)
;; CHECK-NEXT: (local $0 (ref null $struct.A))
;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.A
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.get $struct.A 1
;; CHECK-NEXT: (block $block (result (ref null $struct.A))
@@ -2693,9 +2420,7 @@
;; NOMNL: (func $two-branches-b (type $none_=>_f64) (result f64)
;; NOMNL-NEXT: (local $0 (ref null $struct.A))
;; NOMNL-NEXT: (local.set $0
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.A
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (struct.get $struct.A 1
;; NOMNL-NEXT: (block $block (result (ref null $struct.A))
@@ -2720,9 +2445,7 @@
(func $two-branches-b (result f64)
(local $0 (ref null $struct.A))
(local.set $0
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(struct.get $struct.A 1
(block $block (result (ref null $struct.A))
@@ -2749,9 +2472,7 @@
;; CHECK: (func $br_if_flow (result f64)
;; CHECK-NEXT: (local $0 (ref null $struct.A))
;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct.A
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: (struct.get $struct.A 1
;; CHECK-NEXT: (block $block (result (ref null $struct.A))
@@ -2770,9 +2491,7 @@
;; NOMNL: (func $br_if_flow (type $none_=>_f64) (result f64)
;; NOMNL-NEXT: (local $0 (ref null $struct.A))
;; NOMNL-NEXT: (local.set $0
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct.A
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (struct.get $struct.A 1
;; NOMNL-NEXT: (block $block (result (ref null $struct.A))
@@ -2791,9 +2510,7 @@
(func $br_if_flow (result f64)
(local $0 (ref null $struct.A))
(local.set $0
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(struct.get $struct.A 1
(block $block (result (ref null $struct.A))
@@ -2823,9 +2540,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -2855,9 +2569,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2878,9 +2589,7 @@
(func $ref-as-non-null
(local $ref (ref null $struct.A))
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
(struct.set $struct.A 0
;; We can see that the input to this RefAsNonNull is always non-null, as
@@ -2911,9 +2620,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -2939,9 +2645,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2958,9 +2661,7 @@
(func $ref-as-non-null-through-local (result i32)
(local $ref (ref null $struct.A))
(local.set $ref
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
;; Copy the allocation through a ref.as_non_null. This must not trap: it may
;; trap if we leave the ref.as_non_null there and also we do not assign
@@ -3001,9 +2702,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (local.get $4)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.const 0)
@@ -3039,9 +2737,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (local.get $4)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (i32.const 0)
@@ -3062,10 +2757,9 @@
;; Our allocation flows into a br_if, which therefore has non-nullable
;; type, which we must update after optimizing.
(br_if $block
- (struct.new_with_rtt $struct.A
+ (struct.new $struct.A
(i32.const 42)
(f64.const 13.37)
- (rtt.canon $struct.A)
)
(i32.const 0)
)
@@ -3075,44 +2769,6 @@
)
)
- ;; CHECK: (func $simple-no-rtt
- ;; CHECK-NEXT: (local $0 i32)
- ;; CHECK-NEXT: (local $1 f64)
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result (ref null $struct.A))
- ;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (i32.const 0)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $1
- ;; CHECK-NEXT: (f64.const 0)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (ref.null $struct.A)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; NOMNL: (func $simple-no-rtt (type $none_=>_none)
- ;; NOMNL-NEXT: (local $0 i32)
- ;; NOMNL-NEXT: (local $1 f64)
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block (result (ref null $struct.A))
- ;; NOMNL-NEXT: (local.set $0
- ;; NOMNL-NEXT: (i32.const 0)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (local.set $1
- ;; NOMNL-NEXT: (f64.const 0)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (ref.null $struct.A)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- (func $simple-no-rtt
- (drop
- ;; This allocation has no rtt, so we have nothing to drop from it when
- ;; we optimize.
- (struct.new_default $struct.A)
- )
- )
-
;; CHECK: (func $pass-through-loop
;; CHECK-NEXT: (local $0 (ref null $struct.A))
;; CHECK-NEXT: (local $1 i32)
@@ -3129,9 +2785,6 @@
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (f64.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct.A)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $struct.A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -3153,9 +2806,6 @@
;; NOMNL-NEXT: (local.set $2
;; NOMNL-NEXT: (f64.const 0)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct.A)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $struct.A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -3172,9 +2822,7 @@
;; block).
(br_if $loop (i32.const 0))
;; The allocation that will be turned into locals.
- (struct.new_default_with_rtt $struct.A
- (rtt.canon $struct.A)
- )
+ (struct.new_default $struct.A)
)
)
)
diff --git a/test/lit/passes/inlining-optimizing.wast b/test/lit/passes/inlining-optimizing.wast
index ac29ba1f9..74748c6a4 100644
--- a/test/lit/passes/inlining-optimizing.wast
+++ b/test/lit/passes/inlining-optimizing.wast
@@ -30,12 +30,10 @@
(call $0)
(drop
(call_ref
- (ref.cast
+ (ref.cast_static $none_=>_i32
(ref.func $0)
- (rtt.canon $none_=>_i32)
)
)
)
)
)
-
diff --git a/test/lit/passes/inlining_all-features.wast b/test/lit/passes/inlining_all-features.wast
index 051201b23..3b2f3a458 100644
--- a/test/lit/passes/inlining_all-features.wast
+++ b/test/lit/passes/inlining_all-features.wast
@@ -208,41 +208,3 @@
)
)
)
-
-;; never inline an rtt parameter, as those cannot be handled as locals
-(module
- ;; CHECK: (type $struct (struct ))
- ;; NOMNL: (type $struct (struct_subtype data))
- (type $struct (struct))
- ;; CHECK: (type $rtt_$struct_=>_none (func (param (rtt $struct))))
-
- ;; CHECK: (type $none_=>_none (func))
-
- ;; CHECK: (func $0 (param $rtt (rtt $struct))
- ;; CHECK-NEXT: (nop)
- ;; CHECK-NEXT: )
- ;; NOMNL: (type $rtt_$struct_=>_none (func_subtype (param (rtt $struct)) func))
-
- ;; NOMNL: (type $none_=>_none (func_subtype func))
-
- ;; NOMNL: (func $0 (type $rtt_$struct_=>_none) (param $rtt (rtt $struct))
- ;; NOMNL-NEXT: (nop)
- ;; NOMNL-NEXT: )
- (func $0 (param $rtt (rtt $struct))
- )
- ;; CHECK: (func $1
- ;; CHECK-NEXT: (call $0
- ;; CHECK-NEXT: (rtt.canon $struct)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; NOMNL: (func $1 (type $none_=>_none)
- ;; NOMNL-NEXT: (call $0
- ;; NOMNL-NEXT: (rtt.canon $struct)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- (func $1
- (call $0
- (rtt.canon $struct)
- )
- )
-)
diff --git a/test/lit/passes/inlining_splitting.wast b/test/lit/passes/inlining_splitting.wast
index 599bb9cc6..678400c7f 100644
--- a/test/lit/passes/inlining_splitting.wast
+++ b/test/lit/passes/inlining_splitting.wast
@@ -14,8 +14,6 @@
;; CHECK: (type $struct (struct ))
(type $struct (struct))
- ;; CHECK: (type $i32_rtt_$struct_=>_none (func (param i32 (rtt $struct))))
-
;; CHECK: (type $i64_i32_f64_=>_none (func (param i64 i32 f64)))
;; CHECK: (import "out" "func" (func $import))
@@ -203,19 +201,8 @@
(call $br-to-toplevel (i32.const 2))
)
- ;; CHECK: (func $nondefaultable-param (param $x i32) (param $y (rtt $struct))
- ;; CHECK-NEXT: (if
- ;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: (return)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (loop $l
- ;; CHECK-NEXT: (call $import)
- ;; CHECK-NEXT: (br $l)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- (func $nondefaultable-param (param $x i32) (param $y (rtt $struct))
- ;; The RTT param here prevents us from even being inlined, even with
- ;; splitting.
+ (func $nondefaultable-param (param $x i32) (param $y (ref $struct))
+ ;; We can inline despite the non-initial, non-defaultable param.
(if
(local.get $x)
(return)
@@ -227,13 +214,30 @@
)
;; CHECK: (func $call-nondefaultable-param
- ;; CHECK-NEXT: (call $nondefaultable-param
- ;; CHECK-NEXT: (i32.const 0)
- ;; CHECK-NEXT: (rtt.canon $struct)
+ ;; CHECK-NEXT: (local $0 i32)
+ ;; CHECK-NEXT: (local $1 (ref null $struct))
+ ;; CHECK-NEXT: (block $__inlined_func$nondefaultable-param
+ ;; CHECK-NEXT: (local.set $0
+ ;; CHECK-NEXT: (i32.const 0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.set $1
+ ;; CHECK-NEXT: (struct.new_default $struct)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (block
+ ;; CHECK-NEXT: (if
+ ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (br $__inlined_func$nondefaultable-param)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (loop $l
+ ;; CHECK-NEXT: (call $import)
+ ;; CHECK-NEXT: (br $l)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (br $__inlined_func$nondefaultable-param)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $call-nondefaultable-param
- (call $nondefaultable-param (i32.const 0) (rtt.canon $struct))
+ (call $nondefaultable-param (i32.const 0) (struct.new $struct))
)
(func $many-params (param $x i64) (param $y i32) (param $z f64)
diff --git a/test/lit/passes/local-cse_all-features.wast b/test/lit/passes/local-cse_all-features.wast
index 8ff3bc253..ff0a746d4 100644
--- a/test/lit/passes/local-cse_all-features.wast
+++ b/test/lit/passes/local-cse_all-features.wast
@@ -187,29 +187,25 @@
;; CHECK: (func $creations
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $A
+ ;; CHECK-NEXT: (struct.new $A
;; CHECK-NEXT: (i32.const 1)
- ;; CHECK-NEXT: (rtt.canon $A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (struct.new_with_rtt $A
+ ;; CHECK-NEXT: (struct.new $A
;; CHECK-NEXT: (i32.const 1)
- ;; CHECK-NEXT: (rtt.canon $A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (array.new_with_rtt $B
+ ;; CHECK-NEXT: (array.new $B
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: (i32.const 1)
- ;; CHECK-NEXT: (rtt.canon $B)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (array.new_with_rtt $B
+ ;; CHECK-NEXT: (array.new $B
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: (i32.const 1)
- ;; CHECK-NEXT: (rtt.canon $B)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -217,29 +213,25 @@
;; Allocating GC data has no side effects, but each allocation is unique
;; and so we cannot replace separate allocations with a single one.
(drop
- (struct.new_with_rtt $A
+ (struct.new $A
(i32.const 1)
- (rtt.canon $A)
)
)
(drop
- (struct.new_with_rtt $A
+ (struct.new $A
(i32.const 1)
- (rtt.canon $A)
)
)
(drop
- (array.new_with_rtt $B
+ (array.new $B
(i32.const 1)
(i32.const 1)
- (rtt.canon $B)
)
)
(drop
- (array.new_with_rtt $B
+ (array.new $B
(i32.const 1)
(i32.const 1)
- (rtt.canon $B)
)
)
)
diff --git a/test/lit/passes/optimize-instructions-call_ref.wast b/test/lit/passes/optimize-instructions-call_ref.wast
index b92e976bb..c3a607d07 100644
--- a/test/lit/passes/optimize-instructions-call_ref.wast
+++ b/test/lit/passes/optimize-instructions-call_ref.wast
@@ -163,9 +163,6 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.func $return-nothing)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $none_=>_i32)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -178,9 +175,8 @@
;; call_ref that returns nothing with a call that returns an i32. In fact, we
;; end up optimizing the cast into an unreachable.
(call_ref
- (ref.cast
+ (ref.cast_static $none_=>_i32
(ref.func $return-nothing)
- (rtt.canon $none_=>_i32)
)
)
)
diff --git a/test/lit/passes/optimize-instructions-gc-iit.wast b/test/lit/passes/optimize-instructions-gc-iit.wast
index 4117dce19..3f0c926d3 100644
--- a/test/lit/passes/optimize-instructions-gc-iit.wast
+++ b/test/lit/passes/optimize-instructions-gc-iit.wast
@@ -33,107 +33,65 @@
(func $foo)
- ;; CHECK: (func $ref-cast-iit (param $parent (ref $parent)) (param $child (ref $child)) (param $other (ref $other)) (param $parent-rtt (rtt $parent)) (param $child-rtt (rtt $child)) (param $other-rtt (rtt $other))
+ ;; CHECK: (func $ref-cast-iit (param $parent (ref $parent)) (param $child (ref $child)) (param $other (ref $other))
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result (ref $parent))
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.get $parent-rtt)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $parent)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $parent)
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result (ref $child))
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.get $parent-rtt)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $child)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $child)
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (ref.cast_static $child
;; CHECK-NEXT: (local.get $parent)
- ;; CHECK-NEXT: (local.get $child-rtt)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result (ref $other))
+ ;; CHECK-NEXT: (block
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.get $child)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.get $other-rtt)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $ref-cast-iit (type $ref|$parent|_ref|$child|_ref|$other|_rtt_$parent_rtt_$child_rtt_$other_=>_none) (param $parent (ref $parent)) (param $child (ref $child)) (param $other (ref $other)) (param $parent-rtt (rtt $parent)) (param $child-rtt (rtt $child)) (param $other-rtt (rtt $other))
+ ;; NOMNL: (func $ref-cast-iit (type $ref|$parent|_ref|$child|_ref|$other|_=>_none) (param $parent (ref $parent)) (param $child (ref $child)) (param $other (ref $other))
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block (result (ref $parent))
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (local.get $parent-rtt)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (local.get $parent)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (local.get $parent)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block (result (ref $child))
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (local.get $parent-rtt)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (local.get $child)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (local.get $child)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $child
;; NOMNL-NEXT: (local.get $parent)
- ;; NOMNL-NEXT: (local.get $child-rtt)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block (result (ref $other))
+ ;; NOMNL-NEXT: (block
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (local.get $child)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (local.get $other-rtt)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (unreachable)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
- ;; NOMNL-TNH: (func $ref-cast-iit (type $ref|$parent|_ref|$child|_ref|$other|_rtt_$parent_rtt_$child_rtt_$other_=>_none) (param $parent (ref $parent)) (param $child (ref $child)) (param $other (ref $other)) (param $parent-rtt (rtt $parent)) (param $child-rtt (rtt $child)) (param $other-rtt (rtt $other))
+ ;; NOMNL-TNH: (func $ref-cast-iit (type $ref|$parent|_ref|$child|_ref|$other|_=>_none) (param $parent (ref $parent)) (param $child (ref $child)) (param $other (ref $other))
;; NOMNL-TNH-NEXT: (drop
- ;; NOMNL-TNH-NEXT: (block (result (ref $parent))
- ;; NOMNL-TNH-NEXT: (drop
- ;; NOMNL-TNH-NEXT: (local.get $parent-rtt)
- ;; NOMNL-TNH-NEXT: )
- ;; NOMNL-TNH-NEXT: (local.get $parent)
- ;; NOMNL-TNH-NEXT: )
+ ;; NOMNL-TNH-NEXT: (local.get $parent)
;; NOMNL-TNH-NEXT: )
;; NOMNL-TNH-NEXT: (drop
- ;; NOMNL-TNH-NEXT: (block (result (ref $child))
- ;; NOMNL-TNH-NEXT: (drop
- ;; NOMNL-TNH-NEXT: (local.get $parent-rtt)
- ;; NOMNL-TNH-NEXT: )
- ;; NOMNL-TNH-NEXT: (local.get $child)
- ;; NOMNL-TNH-NEXT: )
+ ;; NOMNL-TNH-NEXT: (local.get $child)
;; NOMNL-TNH-NEXT: )
;; NOMNL-TNH-NEXT: (drop
- ;; NOMNL-TNH-NEXT: (ref.cast
+ ;; NOMNL-TNH-NEXT: (ref.cast_static $child
;; NOMNL-TNH-NEXT: (local.get $parent)
- ;; NOMNL-TNH-NEXT: (local.get $child-rtt)
;; NOMNL-TNH-NEXT: )
;; NOMNL-TNH-NEXT: )
;; NOMNL-TNH-NEXT: (drop
- ;; NOMNL-TNH-NEXT: (block (result (ref $other))
+ ;; NOMNL-TNH-NEXT: (block
;; NOMNL-TNH-NEXT: (drop
;; NOMNL-TNH-NEXT: (local.get $child)
;; NOMNL-TNH-NEXT: )
- ;; NOMNL-TNH-NEXT: (drop
- ;; NOMNL-TNH-NEXT: (local.get $other-rtt)
- ;; NOMNL-TNH-NEXT: )
;; NOMNL-TNH-NEXT: (unreachable)
;; NOMNL-TNH-NEXT: )
;; NOMNL-TNH-NEXT: )
@@ -143,174 +101,91 @@
(param $child (ref $child))
(param $other (ref $other))
- (param $parent-rtt (rtt $parent))
- (param $child-rtt (rtt $child))
- (param $other-rtt (rtt $other))
-
- ;; a cast of parent to an rtt of parent: assuming no traps as we do, we can
- ;; optimize this as the new type will be valid.
+ ;; a cast of parent to parent. We can optimize this as the new type will be
+ ;; valid.
(drop
- (ref.cast
+ (ref.cast_static $parent
(local.get $parent)
- (local.get $parent-rtt)
)
)
;; a cast of child to a supertype: again, we replace with a valid type.
(drop
- (ref.cast
+ (ref.cast_static $parent
(local.get $child)
- (local.get $parent-rtt)
)
)
;; a cast of parent to a subtype: we cannot replace the original heap type
;; $child with one that is not equal or more specific, like $parent, so we
;; cannot optimize here.
(drop
- (ref.cast
+ (ref.cast_static $child
(local.get $parent)
- (local.get $child-rtt)
)
)
;; a cast of child to an unrelated type: it will trap anyhow
(drop
- (ref.cast
+ (ref.cast_static $other
(local.get $child)
- (local.get $other-rtt)
)
)
)
- ;; CHECK: (func $ref-cast-iit-bad (param $parent (ref $parent)) (param $parent-rtt (rtt $parent))
- ;; CHECK-NEXT: (local $2 (ref null $parent))
+ ;; CHECK: (func $ref-cast-iit-bad (param $parent (ref $parent))
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result (ref $parent))
- ;; CHECK-NEXT: (local.set $2
- ;; CHECK-NEXT: (block $block (result (ref $parent))
- ;; CHECK-NEXT: (call $foo)
- ;; CHECK-NEXT: (local.get $parent)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block $block0 (result (rtt $parent))
- ;; CHECK-NEXT: (call $foo)
- ;; CHECK-NEXT: (local.get $parent-rtt)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (ref.as_non_null
- ;; CHECK-NEXT: (local.get $2)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (block $block (result (ref $parent))
+ ;; CHECK-NEXT: (call $foo)
;; CHECK-NEXT: (local.get $parent)
- ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (ref.cast_static $parent
;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: (local.get $parent-rtt)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $ref-cast-iit-bad (type $ref|$parent|_rtt_$parent_=>_none) (param $parent (ref $parent)) (param $parent-rtt (rtt $parent))
- ;; NOMNL-NEXT: (local $2 (ref null $parent))
+ ;; NOMNL: (func $ref-cast-iit-bad (type $ref|$parent|_=>_none) (param $parent (ref $parent))
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block (result (ref $parent))
- ;; NOMNL-NEXT: (local.set $2
- ;; NOMNL-NEXT: (block $block (result (ref $parent))
- ;; NOMNL-NEXT: (call $foo)
- ;; NOMNL-NEXT: (local.get $parent)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block $block0 (result (rtt $parent))
- ;; NOMNL-NEXT: (call $foo)
- ;; NOMNL-NEXT: (local.get $parent-rtt)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (ref.as_non_null
- ;; NOMNL-NEXT: (local.get $2)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (block $block (result (ref $parent))
+ ;; NOMNL-NEXT: (call $foo)
;; NOMNL-NEXT: (local.get $parent)
- ;; NOMNL-NEXT: (unreachable)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $parent
;; NOMNL-NEXT: (unreachable)
- ;; NOMNL-NEXT: (local.get $parent-rtt)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
- ;; NOMNL-TNH: (func $ref-cast-iit-bad (type $ref|$parent|_rtt_$parent_=>_none) (param $parent (ref $parent)) (param $parent-rtt (rtt $parent))
- ;; NOMNL-TNH-NEXT: (local $2 (ref null $parent))
+ ;; NOMNL-TNH: (func $ref-cast-iit-bad (type $ref|$parent|_=>_none) (param $parent (ref $parent))
;; NOMNL-TNH-NEXT: (drop
- ;; NOMNL-TNH-NEXT: (block (result (ref $parent))
- ;; NOMNL-TNH-NEXT: (local.set $2
- ;; NOMNL-TNH-NEXT: (block $block (result (ref $parent))
- ;; NOMNL-TNH-NEXT: (call $foo)
- ;; NOMNL-TNH-NEXT: (local.get $parent)
- ;; NOMNL-TNH-NEXT: )
- ;; NOMNL-TNH-NEXT: )
- ;; NOMNL-TNH-NEXT: (drop
- ;; NOMNL-TNH-NEXT: (block $block0 (result (rtt $parent))
- ;; NOMNL-TNH-NEXT: (call $foo)
- ;; NOMNL-TNH-NEXT: (local.get $parent-rtt)
- ;; NOMNL-TNH-NEXT: )
- ;; NOMNL-TNH-NEXT: )
- ;; NOMNL-TNH-NEXT: (ref.as_non_null
- ;; NOMNL-TNH-NEXT: (local.get $2)
- ;; NOMNL-TNH-NEXT: )
- ;; NOMNL-TNH-NEXT: )
- ;; NOMNL-TNH-NEXT: )
- ;; NOMNL-TNH-NEXT: (drop
- ;; NOMNL-TNH-NEXT: (ref.cast
+ ;; NOMNL-TNH-NEXT: (block $block (result (ref $parent))
+ ;; NOMNL-TNH-NEXT: (call $foo)
;; NOMNL-TNH-NEXT: (local.get $parent)
- ;; NOMNL-TNH-NEXT: (unreachable)
;; NOMNL-TNH-NEXT: )
;; NOMNL-TNH-NEXT: )
;; NOMNL-TNH-NEXT: (drop
- ;; NOMNL-TNH-NEXT: (ref.cast
+ ;; NOMNL-TNH-NEXT: (ref.cast_static $parent
;; NOMNL-TNH-NEXT: (unreachable)
- ;; NOMNL-TNH-NEXT: (local.get $parent-rtt)
;; NOMNL-TNH-NEXT: )
;; NOMNL-TNH-NEXT: )
;; NOMNL-TNH-NEXT: )
(func $ref-cast-iit-bad
(param $parent (ref $parent))
- (param $parent-rtt (rtt $parent))
;; optimizing this cast away requires reordering.
(drop
- (ref.cast
+ (ref.cast_static $parent
(block (result (ref $parent))
(call $foo)
(local.get $parent)
)
- (block (result (rtt $parent))
- (call $foo)
- (local.get $parent-rtt)
- )
)
)
;; ignore unreachability
(drop
- (ref.cast
- (local.get $parent)
- (unreachable)
- )
- )
- (drop
- (ref.cast
+ (ref.cast_static $parent
(unreachable)
- (local.get $parent-rtt)
)
)
)
@@ -335,9 +210,8 @@
(drop
(ref.eq
(local.get $x)
- (ref.cast
+ (ref.cast_static $parent
(local.get $x)
- (rtt.canon $parent)
)
)
)
diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast
index f53237f02..f6a1b5d09 100644
--- a/test/lit/passes/optimize-instructions-gc.wast
+++ b/test/lit/passes/optimize-instructions-gc.wast
@@ -18,24 +18,26 @@
;; NOMNL: (type $A (struct_subtype (field i32) data))
(type $A (struct (field i32)))
+ ;; CHECK: (type $B (struct (field i32) (field i32) (field f32)))
+
;; CHECK: (type $array (array (mut i8)))
+ ;; NOMNL: (type $B (struct_subtype (field i32) (field i32) (field f32) $A))
+
;; NOMNL: (type $array (array_subtype (mut i8) data))
(type $array (array (mut i8)))
- ;; CHECK: (type $B (struct (field i32) (field i32) (field f32)))
- ;; NOMNL: (type $B (struct_subtype (field i32) (field i32) (field f32) $A))
(type $B (struct_subtype (field i32) (field i32) (field f32) $A))
;; CHECK: (type $B-child (struct (field i32) (field i32) (field f32) (field i64)))
;; NOMNL: (type $B-child (struct_subtype (field i32) (field i32) (field f32) (field i64) $B))
(type $B-child (struct_subtype (field i32) (field i32) (field f32) (field i64) $B))
- ;; CHECK: (type $empty (struct ))
+ ;; NOMNL: (type $C (struct_subtype (field i32) (field i32) (field f64) $A))
+
;; NOMNL: (type $empty (struct_subtype data))
(type $empty (struct))
;; CHECK: (type $C (struct (field i32) (field i32) (field f64)))
- ;; NOMNL: (type $C (struct_subtype (field i32) (field i32) (field f64) $A))
(type $C (struct_subtype (field i32) (field i32) (field f64) $A))
;; CHECK: (import "env" "get-i32" (func $get-i32 (result i32)))
@@ -966,12 +968,8 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.eq
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct
- ;; CHECK-NEXT: (rtt.canon $struct)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct
- ;; CHECK-NEXT: (rtt.canon $struct)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $struct)
+ ;; CHECK-NEXT: (struct.new_default $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
@@ -1003,12 +1001,8 @@
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (ref.eq
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct
- ;; NOMNL-NEXT: (rtt.canon $struct)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $struct
- ;; NOMNL-NEXT: (rtt.canon $struct)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $struct)
+ ;; NOMNL-NEXT: (struct.new_default $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
@@ -1042,12 +1036,8 @@
;; allocation prevents optimization
(drop
(ref.eq
- (struct.new_default_with_rtt $struct
- (rtt.canon $struct)
- )
- (struct.new_default_with_rtt $struct
- (rtt.canon $struct)
- )
+ (struct.new_default $struct)
+ (struct.new_default $struct)
)
)
;; but irrelevant allocations do not prevent optimization
@@ -1056,17 +1046,13 @@
(block (result eqref)
;; an allocation that does not trouble us
(drop
- (struct.new_default_with_rtt $struct
- (rtt.canon $struct)
- )
+ (struct.new_default $struct)
)
(local.get $x)
)
(block (result eqref)
(drop
- (struct.new_default_with_rtt $struct
- (rtt.canon $struct)
- )
+ (struct.new_default $struct)
)
;; add a nop to make the two inputs to ref.eq not structurally equal,
;; but in a way that does not matter (since only the value falling
@@ -1091,9 +1077,8 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.eq
;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (ref.cast_static $struct
;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -1102,9 +1087,8 @@
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (ref.eq
;; NOMNL-NEXT: (local.get $x)
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $struct
;; NOMNL-NEXT: (local.get $x)
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -1115,9 +1099,8 @@
(drop
(ref.eq
(local.get $x)
- (ref.cast
+ (ref.cast_static $struct
(local.get $x)
- (rtt.canon $struct)
)
)
)
@@ -1126,132 +1109,117 @@
;; CHECK: (func $flip-cast-of-as-non-null (param $x anyref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.as_non_null
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (ref.cast_static $struct
;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (struct.get_u $struct $i8
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (ref.cast_static $struct
;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (ref.cast_static $struct
;; CHECK-NEXT: (ref.as_func
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (ref.cast_static $struct
;; CHECK-NEXT: (ref.as_data
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (ref.cast_static $struct
;; CHECK-NEXT: (ref.as_i31
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $flip-cast-of-as-non-null (type $anyref_=>_none) (param $x anyref)
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (ref.as_non_null
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $struct
;; NOMNL-NEXT: (local.get $x)
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (struct.get_u $struct $i8
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $struct
;; NOMNL-NEXT: (local.get $x)
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $struct
;; NOMNL-NEXT: (ref.as_func
;; NOMNL-NEXT: (local.get $x)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $struct
;; NOMNL-NEXT: (ref.as_data
;; NOMNL-NEXT: (local.get $x)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $struct
;; NOMNL-NEXT: (ref.as_i31
;; NOMNL-NEXT: (local.get $x)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
(func $flip-cast-of-as-non-null (param $x anyref)
(drop
- (ref.cast
+ (ref.cast_static $struct
;; this can be moved through the ref.cast outward.
(ref.as_non_null
(local.get $x)
)
- (rtt.canon $struct)
)
)
(drop
;; an example of how this helps: the struct.get will trap on null anyhow
(struct.get_u $struct 0
- (ref.cast
+ (ref.cast_static $struct
;; this can be moved through the ref.cast outward.
(ref.as_non_null
(local.get $x)
)
- (rtt.canon $struct)
)
)
)
;; other ref.as* operations are ignored for now
(drop
- (ref.cast
+ (ref.cast_static $struct
(ref.as_func
(local.get $x)
)
- (rtt.canon $struct)
)
)
(drop
- (ref.cast
+ (ref.cast_static $struct
(ref.as_data
(local.get $x)
)
- (rtt.canon $struct)
)
)
(drop
- (ref.cast
+ (ref.cast_static $struct
(ref.as_i31
(local.get $x)
)
- (rtt.canon $struct)
)
)
)
@@ -1461,48 +1429,46 @@
;; CHECK: (func $ref-cast-squared (param $x eqref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (ref.cast_static $struct
;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $ref-cast-squared (type $eqref_=>_none) (param $x eqref)
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $struct
;; NOMNL-NEXT: (local.get $x)
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
(func $ref-cast-squared (param $x eqref)
;; Identical ref.casts can be folded together.
(drop
- (ref.cast
- (ref.cast
+ (ref.cast_static $struct
+ (ref.cast_static $struct
(local.get $x)
- (rtt.canon $struct)
)
- (rtt.canon $struct)
)
)
)
;; CHECK: (func $ref-cast-squared-fallthrough (param $x eqref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.tee $x
- ;; CHECK-NEXT: (ref.cast
- ;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: (rtt.canon $struct)
+ ;; CHECK-NEXT: (ref.cast_static $struct
+ ;; CHECK-NEXT: (local.tee $x
+ ;; CHECK-NEXT: (ref.cast_static $struct
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $ref-cast-squared-fallthrough (type $eqref_=>_none) (param $x eqref)
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (local.tee $x
- ;; NOMNL-NEXT: (ref.cast
- ;; NOMNL-NEXT: (local.get $x)
- ;; NOMNL-NEXT: (rtt.canon $struct)
+ ;; NOMNL-NEXT: (ref.cast_static $struct
+ ;; NOMNL-NEXT: (local.tee $x
+ ;; NOMNL-NEXT: (ref.cast_static $struct
+ ;; NOMNL-NEXT: (local.get $x)
+ ;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -1510,128 +1476,68 @@
(func $ref-cast-squared-fallthrough (param $x eqref)
;; A fallthrough in the middle does not prevent this optimization.
(drop
- (ref.cast
+ (ref.cast_static $struct
(local.tee $x
- (ref.cast
+ (ref.cast_static $struct
(local.get $x)
- (rtt.canon $struct)
)
)
- (rtt.canon $struct)
)
)
)
;; CHECK: (func $ref-cast-cubed (param $x eqref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (ref.cast_static $struct
;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $ref-cast-cubed (type $eqref_=>_none) (param $x eqref)
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $struct
;; NOMNL-NEXT: (local.get $x)
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
(func $ref-cast-cubed (param $x eqref)
;; Three and more also work.
(drop
- (ref.cast
- (ref.cast
- (ref.cast
+ (ref.cast_static $struct
+ (ref.cast_static $struct
+ (ref.cast_static $struct
(local.get $x)
- (rtt.canon $struct)
)
- (rtt.canon $struct)
)
- (rtt.canon $struct)
)
)
)
;; CHECK: (func $ref-cast-squared-different (param $x eqref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
- ;; CHECK-NEXT: (ref.cast
- ;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: (rtt.canon $empty)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (rtt.canon $struct)
+ ;; CHECK-NEXT: (ref.cast_static $struct
+ ;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $ref-cast-squared-different (type $eqref_=>_none) (param $x eqref)
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.cast
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $struct
+ ;; NOMNL-NEXT: (ref.cast_static $empty
;; NOMNL-NEXT: (local.get $x)
- ;; NOMNL-NEXT: (rtt.canon $empty)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
(func $ref-cast-squared-different (param $x eqref)
;; Different casts cannot be folded.
(drop
- (ref.cast
- (ref.cast
- (local.get $x)
- (rtt.canon $empty)
- )
- (rtt.canon $struct)
- )
- )
- )
- ;; CHECK: (func $ref-cast-squared-effects (param $x eqref)
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
- ;; CHECK-NEXT: (ref.cast
- ;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: (call $get-rtt)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (call $get-rtt)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; NOMNL: (func $ref-cast-squared-effects (type $eqref_=>_none) (param $x eqref)
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.cast
- ;; NOMNL-NEXT: (ref.cast
- ;; NOMNL-NEXT: (local.get $x)
- ;; NOMNL-NEXT: (call $get-rtt)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (call $get-rtt)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- (func $ref-cast-squared-effects (param $x eqref)
- ;; The rtts are equal but have side effects, preventing optimization.
- (drop
- (ref.cast
- (ref.cast
+ (ref.cast_static $struct
+ (ref.cast_static $empty
(local.get $x)
- (call $get-rtt)
)
- (call $get-rtt)
)
)
)
- ;; Helper function for above.
- ;; CHECK: (func $get-rtt (result (rtt $empty))
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; NOMNL: (func $get-rtt (type $none_=>_rtt_$empty) (result (rtt $empty))
- ;; NOMNL-NEXT: (unreachable)
- ;; NOMNL-NEXT: )
- (func $get-rtt (result (rtt $empty))
- (unreachable)
- )
-
;; CHECK: (func $ref-eq-null (param $x eqref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.is_null
@@ -2024,9 +1930,6 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.get $struct)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $array)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -2037,18 +1940,14 @@
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (local.get $struct)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $array)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (unreachable)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
(func $incompatible-cast-of-non-null (param $struct (ref $struct))
(drop
- (ref.cast
+ (ref.cast_static $array
(local.get $struct)
- (rtt.canon $array)
)
)
)
@@ -2059,9 +1958,6 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.null $struct)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $array)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $array)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -2073,9 +1969,6 @@
;; CHECK-NEXT: (ref.null $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $array)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (ref.null $array)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -2087,9 +1980,6 @@
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (ref.null $struct)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $array)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $array)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2101,9 +1991,6 @@
;; NOMNL-NEXT: (ref.null $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $array)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (ref.null $array)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2111,45 +1998,40 @@
;; NOMNL-NEXT: )
(func $incompatible-cast-of-null
(drop
- (ref.cast
+ (ref.cast_static $array
(ref.null $struct)
- (rtt.canon $array)
)
)
(drop
- (ref.cast
+ (ref.cast_static $array
;; The fallthrough is null, but the node's child's type is non-nullable,
;; so we must add a ref.as_non_null on the outside to keep the type
;; identical.
(ref.as_non_null
(ref.null $struct)
)
- (rtt.canon $array)
)
)
)
;; CHECK: (func $incompatible-cast-of-unknown (param $struct (ref null $struct))
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (ref.cast_static $array
;; CHECK-NEXT: (local.get $struct)
- ;; CHECK-NEXT: (rtt.canon $array)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $incompatible-cast-of-unknown (type $ref?|$struct|_=>_none) (param $struct (ref null $struct))
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $array
;; NOMNL-NEXT: (local.get $struct)
- ;; NOMNL-NEXT: (rtt.canon $array)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
(func $incompatible-cast-of-unknown (param $struct (ref null $struct))
(drop
- (ref.cast
+ (ref.cast_static $array
(local.get $struct)
- (rtt.canon $array)
)
)
)
@@ -2160,9 +2042,6 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.get $struct)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $array)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -2173,9 +2052,6 @@
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (local.get $struct)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $array)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (i32.const 0)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2183,70 +2059,61 @@
(func $incompatible-test (param $struct (ref null $struct))
(drop
;; This test will definitely fail, so we can turn it into 0.
- (ref.test
+ (ref.test_static $array
(local.get $struct)
- (rtt.canon $array)
)
)
)
;; CHECK: (func $subtype-compatible (param $A (ref null $A)) (param $B (ref null $B))
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.test
+ ;; CHECK-NEXT: (ref.test_static $B
;; CHECK-NEXT: (local.get $A)
- ;; CHECK-NEXT: (rtt.canon $B)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.test
+ ;; CHECK-NEXT: (ref.test_static $A
;; CHECK-NEXT: (local.get $B)
- ;; CHECK-NEXT: (rtt.canon $A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $subtype-compatible (type $ref?|$A|_ref?|$B|_=>_none) (param $A (ref null $A)) (param $B (ref null $B))
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.test
+ ;; NOMNL-NEXT: (ref.test_static $B
;; NOMNL-NEXT: (local.get $A)
- ;; NOMNL-NEXT: (rtt.canon $B)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.test
+ ;; NOMNL-NEXT: (ref.test_static $A
;; NOMNL-NEXT: (local.get $B)
- ;; NOMNL-NEXT: (rtt.canon $A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
(func $subtype-compatible (param $A (ref null $A)) (param $B (ref null $B))
(drop
;; B is a subtype of A, so this can work.
- (ref.test
+ (ref.test_static $B
(local.get $A)
- (rtt.canon $B)
)
)
(drop
;; The other direction works too.
- (ref.test
+ (ref.test_static $A
(local.get $B)
- (rtt.canon $A)
)
)
)
;; CHECK: (func $ref.test-unreachable (param $A (ref null $A))
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.test
+ ;; CHECK-NEXT: (ref.test_static $A
;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: (rtt.canon $A)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $ref.test-unreachable (type $ref?|$A|_=>_none) (param $A (ref null $A))
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.test
+ ;; NOMNL-NEXT: (ref.test_static $A
;; NOMNL-NEXT: (unreachable)
- ;; NOMNL-NEXT: (rtt.canon $A)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -2254,42 +2121,39 @@
(drop
;; We should ignore unreachable ref.tests and not try to compare their
;; HeapTypes.
- (ref.test
+ (ref.test_static $A
(unreachable)
- (rtt.canon $A)
)
)
)
;; CHECK: (func $consecutive-opts-with-unreachable (param $func funcref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (ref.cast_static $struct
;; CHECK-NEXT: (block (result dataref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.get $func)
;; CHECK-NEXT: )
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $consecutive-opts-with-unreachable (type $funcref_=>_none) (param $func funcref)
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $struct
;; NOMNL-NEXT: (block (result dataref)
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (local.get $func)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (unreachable)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
(func $consecutive-opts-with-unreachable (param $func funcref)
(drop
- (ref.cast
+ (ref.cast_static $struct
;; Casting a funcref to data will definitely fail, so this will be
;; replaced with an unreachable. But it should be enclosed in a block of
;; the previous type, so that the outside ref.cast is not confused. This
@@ -2302,7 +2166,6 @@
(ref.as_data
(local.get $func)
)
- (rtt.canon $struct)
)
)
)
diff --git a/test/lit/passes/optimize-instructions-iit-eh.wast b/test/lit/passes/optimize-instructions-iit-eh.wast
index b297cb7df..ee6b78738 100644
--- a/test/lit/passes/optimize-instructions-iit-eh.wast
+++ b/test/lit/passes/optimize-instructions-iit-eh.wast
@@ -5,33 +5,17 @@
(module
;; CHECK: (type $struct.A (struct (field i32)))
(type $struct.A (struct i32))
- ;; CHECK: (global $g-struct.A (rtt $struct.A) (rtt.canon $struct.A))
-
;; CHECK: (tag $e (param (ref null $struct.A)))
(tag $e (param (ref null $struct.A)))
- (global $g-struct.A (rtt $struct.A) (rtt.canon $struct.A))
;; CHECK: (func $ref-cast-statically-removed
- ;; CHECK-NEXT: (local $0 (ref null $struct.A))
- ;; CHECK-NEXT: (local $1 (ref null $struct.A))
;; CHECK-NEXT: (try $try
;; CHECK-NEXT: (do
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
;; CHECK-NEXT: (catch $e
- ;; CHECK-NEXT: (local.set $1
- ;; CHECK-NEXT: (pop (ref null $struct.A))
- ;; CHECK-NEXT: )
;; CHECK-NEXT: (throw $e
- ;; CHECK-NEXT: (block (result (ref null $struct.A))
- ;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (local.get $1)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (global.get $g-struct.A)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.get $0)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (pop (ref null $struct.A))
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -41,15 +25,14 @@
(do)
(catch $e
(throw $e
- ;; Because --ignore-implicit-traps is given, this ref.cast is assumed
- ;; not to throw so this ref.cast can be statically removed. But that
- ;; creates a block around this, making 'pop' nested into it, which is
- ;; invalid. We fix this up at the end up OptimizeInstruction,
+ ;; Because --ignore-implicit-traps is given, this ref.cast_static is
+ ;; assumed not to throw so this ref.cast can be statically removed.
+ ;; But that creates a block around this, making 'pop' nested into it,
+ ;; which is invalid. We fix this up at the end up OptimizeInstruction,
;; assigning the 'pop' to a local at the start of this 'catch' body
;; and later using 'local.get' to get it.
- (ref.cast
+ (ref.cast_static $struct.A
(pop (ref null $struct.A))
- (global.get $g-struct.A)
)
)
)
diff --git a/test/lit/passes/precompute-gc.wast b/test/lit/passes/precompute-gc.wast
index 14347bd3c..161b1fe07 100644
--- a/test/lit/passes/precompute-gc.wast
+++ b/test/lit/passes/precompute-gc.wast
@@ -74,9 +74,8 @@
;; CHECK: (func $load-from-struct
;; CHECK-NEXT: (local $x (ref null $struct))
;; CHECK-NEXT: (local.set $x
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 1)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $log
@@ -85,9 +84,8 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $x
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 2)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $log
@@ -108,9 +106,8 @@
;; NOMNL: (func $load-from-struct (type $none_=>_none)
;; NOMNL-NEXT: (local $x (ref null $struct))
;; NOMNL-NEXT: (local.set $x
- ;; NOMNL-NEXT: (struct.new_with_rtt $struct
+ ;; NOMNL-NEXT: (struct.new $struct
;; NOMNL-NEXT: (i32.const 1)
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (call $log
@@ -119,9 +116,8 @@
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $x
- ;; NOMNL-NEXT: (struct.new_with_rtt $struct
+ ;; NOMNL-NEXT: (struct.new $struct
;; NOMNL-NEXT: (i32.const 2)
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (call $log
@@ -142,9 +138,8 @@
(func $load-from-struct
(local $x (ref null $struct))
(local.set $x
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 1)
- (rtt.canon $struct)
)
)
;; we don't precompute these, as we don't know if the GC data was modified
@@ -154,9 +149,8 @@
)
;; Assign a new struct
(local.set $x
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 2)
- (rtt.canon $struct)
)
)
(call $log
@@ -176,15 +170,13 @@
;; CHECK-NEXT: (if
;; CHECK-NEXT: (local.get $i)
;; CHECK-NEXT: (local.set $x
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 1)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $x
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 2)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -199,15 +191,13 @@
;; NOMNL-NEXT: (if
;; NOMNL-NEXT: (local.get $i)
;; NOMNL-NEXT: (local.set $x
- ;; NOMNL-NEXT: (struct.new_with_rtt $struct
+ ;; NOMNL-NEXT: (struct.new $struct
;; NOMNL-NEXT: (i32.const 1)
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $x
- ;; NOMNL-NEXT: (struct.new_with_rtt $struct
+ ;; NOMNL-NEXT: (struct.new $struct
;; NOMNL-NEXT: (i32.const 2)
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -223,15 +213,13 @@
(if
(local.get $i)
(local.set $x
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 1)
- (rtt.canon $struct)
)
)
(local.set $x
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 2)
- (rtt.canon $struct)
)
)
)
@@ -277,9 +265,8 @@
;; CHECK: (func $load-from-struct-bad-escape
;; CHECK-NEXT: (local $x (ref null $struct))
;; CHECK-NEXT: (local.set $x
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 1)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $modify-gc-heap
@@ -294,9 +281,8 @@
;; NOMNL: (func $load-from-struct-bad-escape (type $none_=>_none)
;; NOMNL-NEXT: (local $x (ref null $struct))
;; NOMNL-NEXT: (local.set $x
- ;; NOMNL-NEXT: (struct.new_with_rtt $struct
+ ;; NOMNL-NEXT: (struct.new $struct
;; NOMNL-NEXT: (i32.const 1)
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (call $modify-gc-heap
@@ -311,9 +297,8 @@
(func $load-from-struct-bad-escape (export "test")
(local $x (ref null $struct))
(local.set $x
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 1)
- (rtt.canon $struct)
)
)
(call $modify-gc-heap
@@ -431,9 +416,8 @@
;; CHECK-NEXT: (local $y (ref null $struct))
;; CHECK-NEXT: (local $tempresult i32)
;; CHECK-NEXT: (local.set $x
- ;; CHECK-NEXT: (struct.new_with_rtt $struct
+ ;; CHECK-NEXT: (struct.new $struct
;; CHECK-NEXT: (i32.const 1)
- ;; CHECK-NEXT: (rtt.canon $struct)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $y
@@ -449,9 +433,8 @@
;; NOMNL-NEXT: (local $y (ref null $struct))
;; NOMNL-NEXT: (local $tempresult i32)
;; NOMNL-NEXT: (local.set $x
- ;; NOMNL-NEXT: (struct.new_with_rtt $struct
+ ;; NOMNL-NEXT: (struct.new $struct
;; NOMNL-NEXT: (i32.const 1)
- ;; NOMNL-NEXT: (rtt.canon $struct)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $y
@@ -467,9 +450,8 @@
(local $y (ref null $struct))
(local $tempresult i32)
(local.set $x
- (struct.new_with_rtt $struct
+ (struct.new $struct
(i32.const 1)
- (rtt.canon $struct)
)
)
(local.set $y
@@ -492,9 +474,7 @@
;; CHECK-NEXT: (local.set $tempresult
;; CHECK-NEXT: (ref.eq
;; CHECK-NEXT: (local.tee $tempref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $empty
- ;; CHECK-NEXT: (rtt.canon $empty)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $empty)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.get $tempref)
;; CHECK-NEXT: )
@@ -507,9 +487,7 @@
;; NOMNL-NEXT: (local.set $tempresult
;; NOMNL-NEXT: (ref.eq
;; NOMNL-NEXT: (local.tee $tempref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $empty
- ;; NOMNL-NEXT: (rtt.canon $empty)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $empty)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.get $tempref)
;; NOMNL-NEXT: )
@@ -524,9 +502,7 @@
(ref.eq
;; allocate one struct
(local.tee $tempref
- (struct.new_with_rtt $empty
- (rtt.canon $empty)
- )
+ (struct.new $empty)
)
(local.get $tempref)
)
@@ -561,12 +537,8 @@
(local.set $tempresult
;; allocate two different structs
(ref.eq
- (struct.new_with_rtt $empty
- (rtt.canon $empty)
- )
- (struct.new_with_rtt $empty
- (rtt.canon $empty)
- )
+ (struct.new $empty)
+ (struct.new $empty)
)
)
(local.get $tempresult)
@@ -577,9 +549,7 @@
;; CHECK-NEXT: (local $tempref (ref null $empty))
;; CHECK-NEXT: (local.set $tempresult
;; CHECK-NEXT: (ref.eq
- ;; CHECK-NEXT: (struct.new_default_with_rtt $empty
- ;; CHECK-NEXT: (rtt.canon $empty)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $empty)
;; CHECK-NEXT: (local.get $input)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -590,9 +560,7 @@
;; NOMNL-NEXT: (local $tempref (ref null $empty))
;; NOMNL-NEXT: (local.set $tempresult
;; NOMNL-NEXT: (ref.eq
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $empty
- ;; NOMNL-NEXT: (rtt.canon $empty)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $empty)
;; NOMNL-NEXT: (local.get $input)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -605,9 +573,7 @@
;; allocate a struct and compare it to a param, which we know nothing about,
;; so we can infer nothing here at all.
(ref.eq
- (struct.new_with_rtt $empty
- (rtt.canon $empty)
- )
+ (struct.new $empty)
(local.get $input)
)
)
@@ -684,9 +650,7 @@
;; CHECK-NEXT: (local $tempref (ref null $empty))
;; CHECK-NEXT: (local $stashedref (ref null $empty))
;; CHECK-NEXT: (local.set $tempref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $empty
- ;; CHECK-NEXT: (rtt.canon $empty)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $empty)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $stashedref
;; CHECK-NEXT: (local.get $tempref)
@@ -696,9 +660,7 @@
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $tempref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $empty
- ;; CHECK-NEXT: (rtt.canon $empty)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $empty)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $tempresult
@@ -714,9 +676,7 @@
;; NOMNL-NEXT: (local $tempref (ref null $empty))
;; NOMNL-NEXT: (local $stashedref (ref null $empty))
;; NOMNL-NEXT: (local.set $tempref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $empty
- ;; NOMNL-NEXT: (rtt.canon $empty)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $empty)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $stashedref
;; NOMNL-NEXT: (local.get $tempref)
@@ -726,9 +686,7 @@
;; NOMNL-NEXT: (i32.const 0)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $tempref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $empty
- ;; NOMNL-NEXT: (rtt.canon $empty)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $empty)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $tempresult
@@ -744,9 +702,7 @@
(local $tempref (ref null $empty))
(local $stashedref (ref null $empty))
(local.set $tempref
- (struct.new_with_rtt $empty
- (rtt.canon $empty)
- )
+ (struct.new $empty)
)
(local.set $stashedref
(local.get $tempref)
@@ -758,9 +714,7 @@
(i32.const 0)
)
(local.set $tempref
- (struct.new_with_rtt $empty
- (rtt.canon $empty)
- )
+ (struct.new $empty)
)
)
(local.set $tempresult
@@ -777,9 +731,7 @@
;; CHECK-NEXT: (local $tempref (ref null $empty))
;; CHECK-NEXT: (local $stashedref (ref null $empty))
;; CHECK-NEXT: (local.set $tempref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $empty
- ;; CHECK-NEXT: (rtt.canon $empty)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $empty)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $stashedref
;; CHECK-NEXT: (local.get $tempref)
@@ -792,9 +744,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $tempref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $empty
- ;; CHECK-NEXT: (rtt.canon $empty)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $empty)
;; CHECK-NEXT: )
;; CHECK-NEXT: (br_if $loop
;; CHECK-NEXT: (call $helper
@@ -808,9 +758,7 @@
;; NOMNL-NEXT: (local $tempref (ref null $empty))
;; NOMNL-NEXT: (local $stashedref (ref null $empty))
;; NOMNL-NEXT: (local.set $tempref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $empty
- ;; NOMNL-NEXT: (rtt.canon $empty)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $empty)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $stashedref
;; NOMNL-NEXT: (local.get $tempref)
@@ -823,9 +771,7 @@
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $tempref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $empty
- ;; NOMNL-NEXT: (rtt.canon $empty)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $empty)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (br_if $loop
;; NOMNL-NEXT: (call $helper
@@ -839,9 +785,7 @@
(local $tempref (ref null $empty))
(local $stashedref (ref null $empty))
(local.set $tempref
- (struct.new_with_rtt $empty
- (rtt.canon $empty)
- )
+ (struct.new $empty)
)
(local.set $stashedref
(local.get $tempref)
@@ -856,9 +800,7 @@
)
)
(local.set $tempref
- (struct.new_with_rtt $empty
- (rtt.canon $empty)
- )
+ (struct.new $empty)
)
(br_if $loop
(call $helper
@@ -873,9 +815,7 @@
;; CHECK-NEXT: (local $tempref (ref null $empty))
;; CHECK-NEXT: (local $stashedref (ref null $empty))
;; CHECK-NEXT: (local.set $tempref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $empty
- ;; CHECK-NEXT: (rtt.canon $empty)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $empty)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $stashedref
;; CHECK-NEXT: (local.get $tempref)
@@ -896,9 +836,7 @@
;; NOMNL-NEXT: (local $tempref (ref null $empty))
;; NOMNL-NEXT: (local $stashedref (ref null $empty))
;; NOMNL-NEXT: (local.set $tempref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $empty
- ;; NOMNL-NEXT: (rtt.canon $empty)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $empty)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $stashedref
;; NOMNL-NEXT: (local.get $tempref)
@@ -921,9 +859,7 @@
;; As above, but remove the new in the loop, so that each loop iteration does
;; in fact have the ref locals identical, and we can precompute a 1.
(local.set $tempref
- (struct.new_with_rtt $empty
- (rtt.canon $empty)
- )
+ (struct.new $empty)
)
(local.set $stashedref
(local.get $tempref)
@@ -949,9 +885,7 @@
;; CHECK-NEXT: (local $stashedref (ref null $empty))
;; CHECK-NEXT: (loop $loop
;; CHECK-NEXT: (local.set $tempref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $empty
- ;; CHECK-NEXT: (rtt.canon $empty)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $empty)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $stashedref
;; CHECK-NEXT: (local.get $tempref)
@@ -972,9 +906,7 @@
;; NOMNL-NEXT: (local $stashedref (ref null $empty))
;; NOMNL-NEXT: (loop $loop
;; NOMNL-NEXT: (local.set $tempref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $empty
- ;; NOMNL-NEXT: (rtt.canon $empty)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $empty)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $stashedref
;; NOMNL-NEXT: (local.get $tempref)
@@ -997,9 +929,7 @@
;; Another example of a loop where we can optimize. Here the new is inside
;; the loop.
(local.set $tempref
- (struct.new_with_rtt $empty
- (rtt.canon $empty)
- )
+ (struct.new $empty)
)
(local.set $stashedref
(local.get $tempref)
@@ -1028,9 +958,7 @@
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $tempref
- ;; CHECK-NEXT: (struct.new_default_with_rtt $empty
- ;; CHECK-NEXT: (rtt.canon $empty)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.new_default $empty)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $stashedref
@@ -1059,9 +987,7 @@
;; NOMNL-NEXT: (i32.const 0)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $tempref
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $empty
- ;; NOMNL-NEXT: (rtt.canon $empty)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (struct.new_default $empty)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $stashedref
@@ -1094,9 +1020,7 @@
(i32.const 0)
)
(local.set $tempref
- (struct.new_with_rtt $empty
- (rtt.canon $empty)
- )
+ (struct.new $empty)
)
)
(local.set $stashedref
@@ -1155,9 +1079,8 @@
;; ref.cast instruction has, that is, the value is a null of type $B). So this
;; is an odd cast that "works".
(local.set $temp
- (ref.cast
+ (ref.cast_static $B
(ref.null $A)
- (rtt.canon $B)
)
)
(drop
@@ -1202,9 +1125,8 @@
;; As above, but with a tuple.
(local.set $temp
(tuple.make
- (ref.cast
+ (ref.cast_static $B
(ref.null $A)
- (rtt.canon $B)
)
(i32.const 10)
)
@@ -1230,9 +1152,8 @@
;; CHECK: (func $odd-cast-and-get-non-null (param $temp (ref $func-return-i32))
;; CHECK-NEXT: (local.set $temp
- ;; CHECK-NEXT: (ref.cast
+ ;; CHECK-NEXT: (ref.cast_static $func-return-i32
;; CHECK-NEXT: (ref.func $receive-f64)
- ;; CHECK-NEXT: (rtt.canon $func-return-i32)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
@@ -1243,9 +1164,8 @@
;; CHECK-NEXT: )
;; NOMNL: (func $odd-cast-and-get-non-null (type $ref|$func-return-i32|_=>_none) (param $temp (ref $func-return-i32))
;; NOMNL-NEXT: (local.set $temp
- ;; NOMNL-NEXT: (ref.cast
+ ;; NOMNL-NEXT: (ref.cast_static $func-return-i32
;; NOMNL-NEXT: (ref.func $receive-f64)
- ;; NOMNL-NEXT: (rtt.canon $func-return-i32)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
@@ -1257,9 +1177,8 @@
(func $odd-cast-and-get-non-null (param $temp (ref $func-return-i32))
;; Try to cast a function to an incompatible type.
(local.set $temp
- (ref.cast
+ (ref.cast_static $func-return-i32
(ref.func $receive-f64)
- (rtt.canon $func-return-i32)
)
)
(drop
@@ -1271,51 +1190,6 @@
)
)
- ;; Regression test checking that breaking RTTs are interpreted correctly.
- ;; CHECK: (func $cast-breaking-rtt
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.cast
- ;; CHECK-NEXT: (ref.cast
- ;; CHECK-NEXT: (struct.new_default $struct)
- ;; CHECK-NEXT: (call $unreachable-rtt)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (call $unreachable-rtt)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; NOMNL: (func $cast-breaking-rtt (type $none_=>_none)
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.cast
- ;; NOMNL-NEXT: (ref.cast
- ;; NOMNL-NEXT: (struct.new_default $struct)
- ;; NOMNL-NEXT: (call $unreachable-rtt)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (call $unreachable-rtt)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- (func $cast-breaking-rtt
- (drop
- (ref.cast
- (ref.cast
- (struct.new_default $struct)
- (call $unreachable-rtt)
- )
- (call $unreachable-rtt)
- )
- )
- )
-
- ;; CHECK: (func $unreachable-rtt (result (rtt $struct))
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; NOMNL: (func $unreachable-rtt (type $none_=>_rtt_$struct) (result (rtt $struct))
- ;; NOMNL-NEXT: (unreachable)
- ;; NOMNL-NEXT: )
- (func $unreachable-rtt (result (rtt $struct))
- (unreachable)
- )
-
;; CHECK: (func $new_block_unreachable (result anyref)
;; CHECK-NEXT: (block ;; (replaces something unreachable we can't emit)
;; CHECK-NEXT: (drop
@@ -1323,9 +1197,6 @@
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (rtt.canon $struct)
- ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $new_block_unreachable (type $none_=>_anyref) (result anyref)
@@ -1335,67 +1206,20 @@
;; NOMNL-NEXT: (unreachable)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (rtt.canon $struct)
- ;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
(func $new_block_unreachable (result anyref)
- (struct.new_with_rtt $struct
+ (struct.new $struct
;; The value is a block with an unreachable. precompute will get rid of the
;; block, after which fuzz-exec should not crash - this is a regression test
;; for us being careful in how we execute an unreachable struct.new
(block $label$1 (result i32)
(unreachable)
)
- (rtt.canon $struct)
- )
- )
-
- ;; CHECK: (func $br_on_cast-on-creation-rtt (result (ref $empty))
- ;; CHECK-NEXT: (block $label (result (ref $empty))
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (br_on_cast $label
- ;; CHECK-NEXT: (struct.new_default_with_rtt $empty
- ;; CHECK-NEXT: (rtt.canon $empty)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (rtt.canon $empty)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; NOMNL: (func $br_on_cast-on-creation-rtt (type $none_=>_ref|$empty|) (result (ref $empty))
- ;; NOMNL-NEXT: (block $label (result (ref $empty))
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (br_on_cast $label
- ;; NOMNL-NEXT: (struct.new_default_with_rtt $empty
- ;; NOMNL-NEXT: (rtt.canon $empty)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (rtt.canon $empty)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (unreachable)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- (func $br_on_cast-on-creation-rtt (result (ref $empty))
- (block $label (result (ref $empty))
- (drop
- ;; The br_on_cast will read the GC data created from struct.new, which must
- ;; emit it properly, including with an RTT which it will read from (since
- ;; this instructions uses an RTT).
- (br_on_cast $label
- (struct.new_default_with_rtt $empty
- (rtt.canon $empty)
- )
- (rtt.canon $empty)
- )
- )
- (unreachable)
)
)
- ;; CHECK: (func $br_on_cast-on-creation-nortt (result (ref $empty))
+ ;; CHECK: (func $br_on_cast-on-creation (result (ref $empty))
;; CHECK-NEXT: (block $label (result (ref $empty))
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (br_on_cast_static $label $empty
@@ -1405,7 +1229,7 @@
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $br_on_cast-on-creation-nortt (type $none_=>_ref|$empty|) (result (ref $empty))
+ ;; NOMNL: (func $br_on_cast-on-creation (type $none_=>_ref|$empty|) (result (ref $empty))
;; NOMNL-NEXT: (block $label (result (ref $empty))
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (br_on_cast_static $label $empty
@@ -1415,10 +1239,9 @@
;; NOMNL-NEXT: (unreachable)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
- (func $br_on_cast-on-creation-nortt (result (ref $empty))
+ (func $br_on_cast-on-creation (result (ref $empty))
(block $label (result (ref $empty))
(drop
- ;; As above, but with no RTTs.
(br_on_cast_static $label $empty
(struct.new_default $empty)
)
diff --git a/test/lit/passes/remove-unused-brs-gc.wast b/test/lit/passes/remove-unused-brs-gc.wast
index 33aa08af5..eb5baa846 100644
--- a/test/lit/passes/remove-unused-brs-gc.wast
+++ b/test/lit/passes/remove-unused-brs-gc.wast
@@ -184,38 +184,6 @@
)
)
- ;; CHECK: (func $br_on_cast_dynamic (result (ref $struct))
- ;; CHECK-NEXT: (local $temp (ref null $struct))
- ;; CHECK-NEXT: (block $block (result (ref $struct))
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (br_on_cast $block
- ;; CHECK-NEXT: (struct.new_default_with_rtt $struct
- ;; CHECK-NEXT: (rtt.canon $struct)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (rtt.canon $struct)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- (func $br_on_cast_dynamic (result (ref $struct))
- (local $temp (ref null $struct))
- (block $block (result (ref $struct))
- (drop
- ;; This dynamic cast happens to be optimizable since we see both sides use
- ;; rtt.canon, but we do not inspect things that closely, and leave such
- ;; dynamic casts to runtime.
- (br_on_cast $block
- (struct.new_with_rtt $struct
- (rtt.canon $struct)
- )
- (rtt.canon $struct)
- )
- )
- (unreachable)
- )
- )
-
;; CHECK: (func $casts-are-costly (param $x i32)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (if (result i32)
diff --git a/test/lit/passes/roundtrip-gc-types.wast b/test/lit/passes/roundtrip-gc-types.wast
index 24d0ef40c..acbfea3a8 100644
--- a/test/lit/passes/roundtrip-gc-types.wast
+++ b/test/lit/passes/roundtrip-gc-types.wast
@@ -10,29 +10,24 @@
;; CHECK: (type $A (struct (field (ref $C))))
;; NOMNL: (type $A (struct_subtype (field (ref $C)) data))
(type $A (struct (field (ref $C))))
- ;; CHECK: (type $D (struct (field (ref $C)) (field (ref $A))))
-
;; CHECK: (type $C (struct (field (mut (ref $B)))))
;; CHECK: (type $B (func (param (ref $A)) (result (ref $B))))
- ;; NOMNL: (type $D (struct_subtype (field (ref $C)) (field (ref $A)) $A))
-
;; NOMNL: (type $C (struct_subtype (field (mut (ref $B))) data))
;; NOMNL: (type $B (func_subtype (param (ref $A)) (result (ref $B)) func))
(type $B (func (param (ref $A)) (result (ref $B))))
(type $C (struct (field (mut (ref $B)))))
+ ;; CHECK: (type $D (struct (field (ref $C)) (field (ref $A))))
+ ;; NOMNL: (type $D (struct_subtype (field (ref $C)) (field (ref $A)) $A))
(type $D (struct_subtype (field (ref $C)) (field (ref $A)) $A))
- ;; CHECK: (global $g0 (rtt 0 $A) (rtt.canon $A))
- ;; NOMNL: (global $g0 (rtt 0 $A) (rtt.canon $A))
- (global $g0 (rtt 0 $A) (rtt.canon $A))
- ;; CHECK: (global $g1 (rtt 1 $D) (rtt.sub $D
- ;; CHECK-NEXT: (global.get $g0)
- ;; CHECK-NEXT: ))
- ;; NOMNL: (global $g1 (rtt 1 $D) (rtt.sub $D
- ;; NOMNL-NEXT: (global.get $g0)
- ;; NOMNL-NEXT: ))
- (global $g1 (rtt 1 $D) (rtt.sub $D
- (global.get $g0)
- ))
+ ;; CHECK: (func $use-types (param $0 (ref $A)) (param $1 (ref $D))
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
+ ;; NOMNL: (func $use-types (type $ref|$A|_ref|$D|_=>_none) (param $0 (ref $A)) (param $1 (ref $D))
+ ;; NOMNL-NEXT: (nop)
+ ;; NOMNL-NEXT: )
+ (func $use-types (param (ref $A) (ref $D))
+ (nop)
+ )
)
diff --git a/test/lit/passes/roundtrip-gc.wast b/test/lit/passes/roundtrip-gc.wast
index 2fb5d57b2..cc38de819 100644
--- a/test/lit/passes/roundtrip-gc.wast
+++ b/test/lit/passes/roundtrip-gc.wast
@@ -9,7 +9,7 @@
(export "export" (func $test))
;; CHECK: (func $test
;; CHECK-NEXT: (call $help
- ;; CHECK-NEXT: (rtt.canon $\7bi32\7d)
+ ;; CHECK-NEXT: (struct.new_default $\7bi32\7d)
;; CHECK-NEXT: (block $label$1 (result i32)
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: (i32.const 1)
@@ -18,7 +18,7 @@
;; CHECK-NEXT: )
;; NOMNL: (func $test (type $none_=>_none)
;; NOMNL-NEXT: (call $help
- ;; NOMNL-NEXT: (rtt.canon $\7bi32\7d)
+ ;; NOMNL-NEXT: (struct.new_default $\7bi32\7d)
;; NOMNL-NEXT: (block $label$1 (result i32)
;; NOMNL-NEXT: (nop)
;; NOMNL-NEXT: (i32.const 1)
@@ -27,25 +27,27 @@
;; NOMNL-NEXT: )
(func $test
(call $help
- (rtt.canon ${i32})
+ (struct.new_default ${i32})
;; Stack IR optimizations can remove this block, leaving a nop in an odd
;; "stacky" location. On load, we would normally use a local to work around
- ;; that, creating a block to contain the rtt before us and the nop, and then
- ;; returning the local. But we can't use a local for an rtt, so we should not
- ;; optimize this sort of thing in stack IR.
+ ;; that, creating a block to contain the non-nullable reference before us and
+ ;; the nop, and then returning the local. But we can't use a local for a
+ ;; non-nullable reference, so we should not optimize this sort of thing in
+ ;; stack IR.
+ ;; TODO: This shouldn't be true after #4824 is resolved.
(block (result i32)
(nop)
(i32.const 1)
)
)
)
- ;; CHECK: (func $help (param $3 (rtt $\7bi32\7d)) (param $4 i32)
+ ;; CHECK: (func $help (param $3 (ref $\7bi32\7d)) (param $4 i32)
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
- ;; NOMNL: (func $help (type $rtt_$\7bi32\7d_i32_=>_none) (param $3 (rtt $\7bi32\7d)) (param $4 i32)
+ ;; NOMNL: (func $help (type $ref|$\7bi32\7d|_i32_=>_none) (param $3 (ref $\7bi32\7d)) (param $4 i32)
;; NOMNL-NEXT: (nop)
;; NOMNL-NEXT: )
- (func $help (param $3 (rtt ${i32})) (param $4 i32)
+ (func $help (param $3 (ref ${i32})) (param $4 i32)
(nop)
)
)
diff --git a/test/lit/passes/vacuum-gc.wast b/test/lit/passes/vacuum-gc.wast
index 71f0e39c2..57b298443 100644
--- a/test/lit/passes/vacuum-gc.wast
+++ b/test/lit/passes/vacuum-gc.wast
@@ -51,39 +51,31 @@
)
)
- ;; CHECK: (func $vacuum-rtt-with-depth
+ ;; CHECK: (func $vacuum-nonnull
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
- (func $vacuum-rtt-with-depth
+ (func $vacuum-nonnull
(drop
- (if (result (rtt 1 ${}))
+ (if (result (ref ${}))
(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 ${})
- )
+ ;; generate a replacement zero for the block's fallthrough value. A
+ ;; non-nullable reference is a problem for that, since we don't want to
+ ;; synthesize and allocate a new struct value. Vacuum should not error
+ ;; on this case, though. Instead, the end result of this function should
+ ;; simply be empty, as everything here can be vacuumed away.
+ (block (result (ref ${}))
+ (struct.new ${})
)
(unreachable)
)
)
)
- ;; CHECK: (func $drop-i31.get (param $ref (ref null i31)) (param $ref-nn i31ref)
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (i31.get_s
- ;; CHECK-NEXT: (local.get $ref)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
+ ;; CHECK: (func $drop-i31.get (param $ref i31ref) (param $ref-nn i31ref)
+ ;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
- (func $drop-i31.get (param $ref (ref null i31)) (param $ref-nn (ref i31))
+ (func $drop-i31.get (param $ref i31ref) (param $ref-nn (ref i31))
;; A nullable get might trap, so only the second item can be removed.
(drop
(i31.get_s