blob: f1670430f20178236a4a823df11dd4c8cb591939 [file] [edit]
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; Check that tables with initialization expressions validate and roundtrip correctly.
;; RUN: foreach %s %t wasm-opt -all --roundtrip -S -o - | filecheck %s
;; non-nullable table with initialization expression
(module
;; CHECK: (type $0 (func (param i32)))
(type $0 (func (param i32)))
;; CHECK: (table $0 0 (ref $0) (ref.func $0))
(table $0 0 (ref $0) (ref.func $0))
;; CHECK: (func $0 (type $0) (param $0 i32)
;; CHECK-NEXT: )
(func $0 (param $0 i32)
)
)
;; nullable table with initialization expression
(module
;; CHECK: (type $0 (func (param i32)))
(type $0 (func (param i32)))
;; CHECK: (table $0 0 funcref (ref.func $0))
(table $0 0 funcref (ref.func $0))
;; CHECK: (func $0 (type $0) (param $0 i32)
;; CHECK-NEXT: )
(func $0 (type $0) (param $0 i32)
)
)
;; table with initialization expression referring to imported global
(module
;; CHECK: (type $0 (func (param i32)))
(type $0 (func (param i32)))
(global $0 (import "env" "global") (ref $0))
;; CHECK: (import "env" "global" (global $0 (ref $0)))
;; CHECK: (table $0 0 (ref $0) (global.get $0))
(table $0 0 (ref $0) (global.get $0))
)
;; imported table of non-nullable type (no initialization expression)
(module
;; CHECK: (type $0 (func (param i32)))
(type $0 (func (param i32)))
(table $0 (import "env" "table") 0 (ref $0))
)
;; CHECK: (import "env" "table" (table $0 0 (ref $0)))