blob: 5ed784df23dd1a6f5b8ea24ed9e90afe4b5e9aed [file]
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; RUN: wasm-merge %s first %s.second second -all -S -o - | filecheck %s
;; Like table-init.wat, but the global $g that the table initializer refers to
;; is fused with a global whose initializer itself refers to another
;; module-defined global, $a. Inlining $g exposes a reference to $a, which must
;; be inlined as well, so verify that we keep inlining until the initializer
;; refers to no module-defined globals.
(module
;; CHECK: (type $f (func))
(type $f (func))
(global $g (import "second" "g") (ref $f))
;; CHECK: (global $a (ref $f) (ref.func $h))
;; CHECK: (global $g_1 (ref $f) (global.get $a))
;; CHECK: (table $t 3 funcref (ref.func $h))
(table $t (export "t") 3 funcref (global.get $g))
)
;; CHECK: (export "t" (table $t))
;; CHECK: (export "g" (global $g_1))
;; CHECK: (func $h (type $f)
;; CHECK-NEXT: )