summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-01-02 12:08:33 -0800
committerGitHub <noreply@github.com>2024-01-02 12:08:33 -0800
commit95ed4f3f0bf0a463cee88a63c5becde4d28692ff (patch)
tree9aa47f97492132f134df4f30c33c7b143a03455b
parent98cef80eabe2171bb3076767d68b25a85d268c12 (diff)
downloadbinaryen-95ed4f3f0bf0a463cee88a63c5becde4d28692ff.tar.gz
binaryen-95ed4f3f0bf0a463cee88a63c5becde4d28692ff.tar.bz2
binaryen-95ed4f3f0bf0a463cee88a63c5becde4d28692ff.zip
Match names more precisely in update_lit_checks.py (#6190)
Previously the lit test update script interpreted module names as the names of import items and export names as the names of export items, but it is more precise to use the actual identifiers of the imported or exported items as the names instead. Update update_lit_checks.py to use a more correct regex to match names and to correctly use the identifiers of import and export items as their names. In some cases this can improve the readability of test output.
-rwxr-xr-xscripts/update_lit_checks.py20
-rw-r--r--test/lit/basic/empty_imported_table.wast9
-rw-r--r--test/lit/basic/export-import.wast19
-rw-r--r--test/lit/basic/hello_world.wat3
-rw-r--r--test/lit/basic/imported_memory.wast11
-rw-r--r--test/lit/basic/imported_memory_growth.wast11
-rw-r--r--test/lit/basic/memory-import.wast3
-rw-r--r--test/lit/basic/memory-import64.wast3
-rw-r--r--test/lit/basic/min.wast3
-rw-r--r--test/lit/basic/multi-memories-basics.wast11
-rw-r--r--test/lit/basic/multi-table.wast7
-rw-r--r--test/lit/basic/mutable-global.wast3
-rw-r--r--test/lit/basic/newsyntax.wast25
-rw-r--r--test/lit/basic/polymorphic_stack.wast33
-rw-r--r--test/lit/basic/reference-types.wast10
-rw-r--r--test/lit/basic/table-import.wast9
-rw-r--r--test/lit/basic/tags.wast37
-rw-r--r--test/lit/basic/unit.wat24
-rw-r--r--test/lit/ctor-eval/ctor_after_serialization.wat28
-rw-r--r--test/lit/ctor-eval/extern.wast45
-rw-r--r--test/lit/ctor-eval/table.wat11
-rw-r--r--test/lit/ctor-eval/v128.wast3
-rw-r--r--test/lit/passes/generate-dyncalls_all-features.wast3
-rw-r--r--test/lit/passes/gufa.wast23
-rw-r--r--test/lit/passes/inlining-optimizing_optimize-level=3.wast52
-rw-r--r--test/lit/passes/jspi-args.wast8
-rw-r--r--test/lit/passes/jspi-table.wast3
-rw-r--r--test/lit/passes/jspi.wast32
-rw-r--r--test/lit/passes/legalize-js-interface-exported-helpers.wast9
-rw-r--r--test/lit/passes/legalize-js-interface-minimally.wast6
-rw-r--r--test/lit/passes/legalize-js-interface_all-features.wast21
-rw-r--r--test/lit/passes/legalize-js-interface_pass-arg=legalize-js-interface-export-originals.wast4
-rw-r--r--test/lit/passes/remove-unused-module-elements-refs.wast40
-rw-r--r--test/lit/passes/remove-unused-module-elements_all-features.wast53
-rw-r--r--test/lit/wasm-split/jspi-secondary-export.wast43
-rw-r--r--test/lit/wasm-split/jspi.wast4
-rw-r--r--test/lit/wasm-split/multi-memory-lowering-export.wast15
-rw-r--r--test/lit/wasm-split/multi-memory-lowering-import.wast11
-rw-r--r--test/lit/wat-kitchen-sink.wast15
39 files changed, 392 insertions, 278 deletions
diff --git a/scripts/update_lit_checks.py b/scripts/update_lit_checks.py
index 79af92ab9..345ff39d0 100755
--- a/scripts/update_lit_checks.py
+++ b/scripts/update_lit_checks.py
@@ -37,12 +37,15 @@ RUN_LINE_RE = re.compile(r'^\s*;;\s*RUN:\s*(.*)$')
CHECK_PREFIX_RE = re.compile(r'.*--check-prefix[= ](\S+).*')
MODULE_RE = re.compile(r'^\(module.*$', re.MULTILINE)
-ALL_ITEMS = '|'.join(['type', 'import', 'global', 'memory', 'data', 'table',
- 'elem', 'tag', 'export', 'start', 'func'])
+DECL_ITEMS = '|'.join(['type', 'global', 'memory', 'data', 'table',
+ 'elem', 'tag', 'start', 'func'])
+IMPORT_ITEM = r'import\s*"[^"]*"\s*"[^"]*"\s*\((?:' + DECL_ITEMS + ')'
+EXPORT_ITEM = r'export\s*"[^"]*"\s*\((?:' + DECL_ITEMS + ')'
+ALL_ITEMS = DECL_ITEMS + '|' + IMPORT_ITEM + '|' + EXPORT_ITEM
# Regular names as well as the "declare" in (elem declare ... to get declarative
# segments included in the output.
-ITEM_NAME = r'\$[^\s()]*|"[^\s()]*"|declare'
+ITEM_NAME = r'\$[^\s()]*|\$"[^"]*"|declare'
# FIXME: This does not handle nested string contents. For example,
# (data (i32.const 10) "hello(")
@@ -55,6 +58,11 @@ ITEM_RE = re.compile(r'(?:^\s*\(rec\s*)?(^\s*)\((' + ALL_ITEMS + r')\s+(' + ITEM
FUZZ_EXEC_FUNC = re.compile(r'^\[fuzz-exec\] calling (?P<name>\S*)$')
+def indentKindName(match):
+ # Return the indent, kind, and name from an ITEM_RE match
+ return (match[1], match[2].split()[0], match[3])
+
+
def warn(msg):
print(f'warning: {msg}', file=sys.stderr)
@@ -141,7 +149,7 @@ def parse_output_modules(text):
for module in split_modules(text):
items = []
for match in ITEM_RE.finditer(module):
- kind, name = match[2], match[3]
+ _, kind, name = indentKindName(match)
end = find_end(module, match.end(1))
lines = module[match.start():end].split('\n')
items.append(((kind, name), lines))
@@ -247,7 +255,7 @@ def update_test(args, test, lines, tmp):
for line in lines:
match = ITEM_RE.match(line)
if match:
- kind, name = match[2], match[3]
+ _, kind, name = indentKindName(match)
named_items.append((kind, name))
script = script_name
@@ -286,7 +294,7 @@ def update_test(args, test, lines, tmp):
output_lines.append(line)
continue
- indent, kind, name = match.groups()
+ indent, kind, name = indentKindName(match)
for prefix, items in output.items():
# If the output for this prefix contains an item with this
diff --git a/test/lit/basic/empty_imported_table.wast b/test/lit/basic/empty_imported_table.wast
index 1a874dc08..5cc6d178c 100644
--- a/test/lit/basic/empty_imported_table.wast
+++ b/test/lit/basic/empty_imported_table.wast
@@ -10,12 +10,15 @@
;; RUN: cat %t.bin.nodebug.wast | filecheck %s --check-prefix=CHECK-BIN-NODEBUG
(module
- ;; CHECK-TEXT: (import "env" "table" (table $timport$0 0 0 funcref))
- ;; CHECK-BIN: (import "env" "table" (table $timport$0 0 0 funcref))
- ;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 0 0 funcref))
(import "env" "table" (table 0 0 funcref))
+ ;; CHECK-TEXT: (import "env" "table" (table $timport$0 0 0 funcref))
+
;; CHECK-TEXT: (memory $0 0)
+ ;; CHECK-BIN: (import "env" "table" (table $timport$0 0 0 funcref))
+
;; CHECK-BIN: (memory $0 0)
+ ;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 0 0 funcref))
+
;; CHECK-BIN-NODEBUG: (memory $0 0)
(memory $0 0)
)
diff --git a/test/lit/basic/export-import.wast b/test/lit/basic/export-import.wast
index 853e1d93a..717681138 100644
--- a/test/lit/basic/export-import.wast
+++ b/test/lit/basic/export-import.wast
@@ -14,21 +14,26 @@
;; CHECK-BIN: (type $v (func))
(type $v (func))
;; CHECK-TEXT: (import "env" "test2" (global $test2 i32))
- ;; CHECK-BIN: (import "env" "test2" (global $test2 i32))
- ;; CHECK-BIN-NODEBUG: (type $0 (func))
- ;; CHECK-BIN-NODEBUG: (import "env" "test2" (global $gimport$0 i32))
- (import "env" "test1" (func $test1))
;; CHECK-TEXT: (import "env" "test1" (func $test1 (type $v)))
+ ;; CHECK-BIN: (import "env" "test2" (global $test2 i32))
+
;; CHECK-BIN: (import "env" "test1" (func $test1 (type $v)))
- ;; CHECK-BIN-NODEBUG: (import "env" "test1" (func $fimport$0 (type $0)))
+ (import "env" "test1" (func $test1))
(import "env" "test2" (global $test2 i32))
;; CHECK-TEXT: (export "test1" (func $test1))
;; CHECK-BIN: (export "test1" (func $test1))
- ;; CHECK-BIN-NODEBUG: (export "test1" (func $fimport$0))
(export "test1" (func $test1))
;; CHECK-TEXT: (export "test2" (global $test2))
;; CHECK-BIN: (export "test2" (global $test2))
- ;; CHECK-BIN-NODEBUG: (export "test2" (global $gimport$0))
(export "test2" (global $test2))
)
+;; CHECK-BIN-NODEBUG: (type $0 (func))
+
+;; CHECK-BIN-NODEBUG: (import "env" "test2" (global $gimport$0 i32))
+
+;; CHECK-BIN-NODEBUG: (import "env" "test1" (func $fimport$0 (type $0)))
+
+;; CHECK-BIN-NODEBUG: (export "test1" (func $fimport$0))
+
+;; CHECK-BIN-NODEBUG: (export "test2" (global $gimport$0))
diff --git a/test/lit/basic/hello_world.wat b/test/lit/basic/hello_world.wat
index 5ddb30128..1ba2f9012 100644
--- a/test/lit/basic/hello_world.wat
+++ b/test/lit/basic/hello_world.wat
@@ -21,7 +21,6 @@
(memory $0 256 256)
;; CHECK-TEXT: (export "add" (func $add))
;; CHECK-BIN: (export "add" (func $add))
- ;; CHECK-BIN-NODEBUG: (export "add" (func $0))
(export "add" (func $add))
;; CHECK-TEXT: (func $add (type $i32_i32_=>_i32) (param $x i32) (param $y i32) (result i32)
;; CHECK-TEXT-NEXT: (i32.add
@@ -42,6 +41,8 @@
)
)
)
+;; CHECK-BIN-NODEBUG: (export "add" (func $0))
+
;; CHECK-BIN-NODEBUG: (func $0 (type $0) (param $0 i32) (param $1 i32) (result i32)
;; CHECK-BIN-NODEBUG-NEXT: (i32.add
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
diff --git a/test/lit/basic/imported_memory.wast b/test/lit/basic/imported_memory.wast
index 52eccce7f..1fa9aaa38 100644
--- a/test/lit/basic/imported_memory.wast
+++ b/test/lit/basic/imported_memory.wast
@@ -12,10 +12,13 @@
(module
;; CHECK-TEXT: (import "env" "memory" (memory $0 256 256))
;; CHECK-BIN: (import "env" "memory" (memory $0 256 256))
- ;; CHECK-BIN-NODEBUG: (import "env" "memory" (memory $mimport$0 256 256))
(import "env" "memory" (memory $0 256 256))
- ;; CHECK-TEXT: (import "env" "table" (table $timport$0 256 256 funcref))
- ;; CHECK-BIN: (import "env" "table" (table $timport$0 256 256 funcref))
- ;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 256 256 funcref))
(import "env" "table" (table 256 256 funcref))
)
+;; CHECK-TEXT: (import "env" "table" (table $timport$0 256 256 funcref))
+
+;; CHECK-BIN: (import "env" "table" (table $timport$0 256 256 funcref))
+
+;; CHECK-BIN-NODEBUG: (import "env" "memory" (memory $mimport$0 256 256))
+
+;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 256 256 funcref))
diff --git a/test/lit/basic/imported_memory_growth.wast b/test/lit/basic/imported_memory_growth.wast
index d1d62c2d9..aa5d02d47 100644
--- a/test/lit/basic/imported_memory_growth.wast
+++ b/test/lit/basic/imported_memory_growth.wast
@@ -12,10 +12,13 @@
(module
;; CHECK-TEXT: (import "env" "memory" (memory $0 256))
;; CHECK-BIN: (import "env" "memory" (memory $0 256))
- ;; CHECK-BIN-NODEBUG: (import "env" "memory" (memory $mimport$0 256))
(import "env" "memory" (memory $0 256))
- ;; CHECK-TEXT: (import "env" "table" (table $timport$0 256 funcref))
- ;; CHECK-BIN: (import "env" "table" (table $timport$0 256 funcref))
- ;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 256 funcref))
(import "env" "table" (table 256 funcref))
)
+;; CHECK-TEXT: (import "env" "table" (table $timport$0 256 funcref))
+
+;; CHECK-BIN: (import "env" "table" (table $timport$0 256 funcref))
+
+;; CHECK-BIN-NODEBUG: (import "env" "memory" (memory $mimport$0 256))
+
+;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 256 funcref))
diff --git a/test/lit/basic/memory-import.wast b/test/lit/basic/memory-import.wast
index fb6a3d623..ce761653d 100644
--- a/test/lit/basic/memory-import.wast
+++ b/test/lit/basic/memory-import.wast
@@ -16,7 +16,6 @@
(type $0 (func (result i32)))
;; CHECK-TEXT: (import "env" "memory" (memory $0 1 1))
;; CHECK-BIN: (import "env" "memory" (memory $0 1 1))
- ;; CHECK-BIN-NODEBUG: (import "env" "memory" (memory $mimport$0 1 1))
(import "env" "memory" (memory $0 1 1))
;; CHECK-TEXT: (func $foo (type $0) (result i32)
@@ -35,6 +34,8 @@
)
)
)
+;; CHECK-BIN-NODEBUG: (import "env" "memory" (memory $mimport$0 1 1))
+
;; CHECK-BIN-NODEBUG: (func $0 (type $0) (result i32)
;; CHECK-BIN-NODEBUG-NEXT: (i32.load offset=13
;; CHECK-BIN-NODEBUG-NEXT: (i32.const 37)
diff --git a/test/lit/basic/memory-import64.wast b/test/lit/basic/memory-import64.wast
index 7794d6b5f..38362d6b2 100644
--- a/test/lit/basic/memory-import64.wast
+++ b/test/lit/basic/memory-import64.wast
@@ -16,7 +16,6 @@
(type $0 (func (result i32)))
;; CHECK-TEXT: (import "env" "memory" (memory $0 i64 1 1))
;; CHECK-BIN: (import "env" "memory" (memory $0 i64 1 1))
- ;; CHECK-BIN-NODEBUG: (import "env" "memory" (memory $mimport$0 i64 1 1))
(import "env" "memory" (memory $0 i64 1 1))
;; CHECK-TEXT: (func $foo (type $0) (result i32)
@@ -35,6 +34,8 @@
)
)
)
+;; CHECK-BIN-NODEBUG: (import "env" "memory" (memory $mimport$0 i64 1 1))
+
;; CHECK-BIN-NODEBUG: (func $0 (type $0) (result i32)
;; CHECK-BIN-NODEBUG-NEXT: (i32.load offset=13
;; CHECK-BIN-NODEBUG-NEXT: (i64.const 37)
diff --git a/test/lit/basic/min.wast b/test/lit/basic/min.wast
index 74898f59f..44928cd83 100644
--- a/test/lit/basic/min.wast
+++ b/test/lit/basic/min.wast
@@ -32,7 +32,6 @@
(memory $0 256 256)
;; CHECK-TEXT: (export "floats" (func $floats))
;; CHECK-BIN: (export "floats" (func $floats))
- ;; CHECK-BIN-NODEBUG: (export "floats" (func $0))
(export "floats" (func $floats))
;; CHECK-TEXT: (func $floats (type $0) (param $f f32) (result f32)
@@ -183,6 +182,8 @@
)
)
)
+;; CHECK-BIN-NODEBUG: (export "floats" (func $0))
+
;; CHECK-BIN-NODEBUG: (func $0 (type $0) (param $0 f32) (result f32)
;; CHECK-BIN-NODEBUG-NEXT: (local $1 f32)
;; CHECK-BIN-NODEBUG-NEXT: (f32.add
diff --git a/test/lit/basic/multi-memories-basics.wast b/test/lit/basic/multi-memories-basics.wast
index c9e4d6c7e..3f023079d 100644
--- a/test/lit/basic/multi-memories-basics.wast
+++ b/test/lit/basic/multi-memories-basics.wast
@@ -18,11 +18,6 @@
(type $none_=>_i32 (func (result i32)))
;; CHECK-TEXT: (import "env" "memory" (memory $importedMemory 1 1))
;; CHECK-BIN: (import "env" "memory" (memory $importedMemory 1 1))
- ;; CHECK-BIN-NODEBUG: (type $0 (func))
-
- ;; CHECK-BIN-NODEBUG: (type $1 (func (result i32)))
-
- ;; CHECK-BIN-NODEBUG: (import "env" "memory" (memory $mimport$0 1 1))
(import "env" "memory" (memory $importedMemory 1 1))
;; CHECK-TEXT: (memory $memory1 1 500)
;; CHECK-BIN: (memory $memory1 1 500)
@@ -367,6 +362,12 @@
)
)
)
+;; CHECK-BIN-NODEBUG: (type $0 (func))
+
+;; CHECK-BIN-NODEBUG: (type $1 (func (result i32)))
+
+;; CHECK-BIN-NODEBUG: (import "env" "memory" (memory $mimport$0 1 1))
+
;; CHECK-BIN-NODEBUG: (memory $0 1 500)
;; CHECK-BIN-NODEBUG: (memory $1 1 800)
diff --git a/test/lit/basic/multi-table.wast b/test/lit/basic/multi-table.wast
index d5c7b10aa..b856f8494 100644
--- a/test/lit/basic/multi-table.wast
+++ b/test/lit/basic/multi-table.wast
@@ -25,9 +25,6 @@
;; CHECK-BIN: (global $g2 i32 (i32.const 0))
(global $g2 i32 (i32.const 0))
- ;; CHECK-BIN-NODEBUG: (type $0 (func))
-
- ;; CHECK-BIN-NODEBUG: (import "a" "b" (table $timport$0 1 10 funcref))
(import "a" "b" (table $t1 1 10 funcref))
;; CHECK-TEXT: (table $t2 3 3 funcref)
;; CHECK-BIN: (table $t2 3 3 funcref)
@@ -116,6 +113,10 @@
;; CHECK-BIN-NEXT: )
(func $h)
)
+;; CHECK-BIN-NODEBUG: (type $0 (func))
+
+;; CHECK-BIN-NODEBUG: (import "a" "b" (table $timport$0 1 10 funcref))
+
;; CHECK-BIN-NODEBUG: (global $global$0 (ref null $0) (ref.func $0))
;; CHECK-BIN-NODEBUG: (global $global$1 i32 (i32.const 0))
diff --git a/test/lit/basic/mutable-global.wast b/test/lit/basic/mutable-global.wast
index 154a40a19..fff5d8d5b 100644
--- a/test/lit/basic/mutable-global.wast
+++ b/test/lit/basic/mutable-global.wast
@@ -16,7 +16,6 @@
(type $0 (func))
;; CHECK-TEXT: (import "env" "global-mut" (global $global-mut (mut i32)))
;; CHECK-BIN: (import "env" "global-mut" (global $global-mut (mut i32)))
- ;; CHECK-BIN-NODEBUG: (import "env" "global-mut" (global $gimport$0 (mut i32)))
(import "env" "global-mut" (global $global-mut (mut i32)))
;; CHECK-TEXT: (func $foo (type $0)
@@ -44,6 +43,8 @@
)
)
)
+;; CHECK-BIN-NODEBUG: (import "env" "global-mut" (global $gimport$0 (mut i32)))
+
;; CHECK-BIN-NODEBUG: (func $0 (type $0)
;; CHECK-BIN-NODEBUG-NEXT: (global.set $gimport$0
;; CHECK-BIN-NODEBUG-NEXT: (i32.add
diff --git a/test/lit/basic/newsyntax.wast b/test/lit/basic/newsyntax.wast
index 204bed3ab..33d805c31 100644
--- a/test/lit/basic/newsyntax.wast
+++ b/test/lit/basic/newsyntax.wast
@@ -10,22 +10,13 @@
;; RUN: cat %t.bin.nodebug.wast | filecheck %s --check-prefix=CHECK-BIN-NODEBUG
(module
+ (import "env" "table" (table 9 9 funcref))
+
;; CHECK-TEXT: (type $0 (func))
;; CHECK-TEXT: (type $1 (func (param i32 f64) (result i32)))
;; CHECK-TEXT: (import "env" "table" (table $timport$0 9 9 funcref))
- ;; CHECK-BIN: (type $0 (func))
-
- ;; CHECK-BIN: (type $1 (func (param i32 f64) (result i32)))
-
- ;; CHECK-BIN: (import "env" "table" (table $timport$0 9 9 funcref))
- ;; CHECK-BIN-NODEBUG: (type $0 (func))
-
- ;; CHECK-BIN-NODEBUG: (type $1 (func (param i32 f64) (result i32)))
-
- ;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 9 9 funcref))
- (import "env" "table" (table 9 9 funcref))
;; CHECK-TEXT: (export "call_indirect" (func $call_indirect))
@@ -41,6 +32,12 @@
;; CHECK-TEXT-NEXT: (i32.const 1)
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (type $0 (func))
+
+ ;; CHECK-BIN: (type $1 (func (param i32 f64) (result i32)))
+
+ ;; CHECK-BIN: (import "env" "table" (table $timport$0 9 9 funcref))
+
;; CHECK-BIN: (export "call_indirect" (func $call_indirect))
;; CHECK-BIN: (func $call_indirect (type $0)
@@ -62,6 +59,12 @@
(call_indirect (i32.const 1))
)
)
+;; CHECK-BIN-NODEBUG: (type $0 (func))
+
+;; CHECK-BIN-NODEBUG: (type $1 (func (param i32 f64) (result i32)))
+
+;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 9 9 funcref))
+
;; CHECK-BIN-NODEBUG: (export "call_indirect" (func $0))
;; CHECK-BIN-NODEBUG: (func $0 (type $0)
diff --git a/test/lit/basic/polymorphic_stack.wast b/test/lit/basic/polymorphic_stack.wast
index f91847817..d51117e16 100644
--- a/test/lit/basic/polymorphic_stack.wast
+++ b/test/lit/basic/polymorphic_stack.wast
@@ -17,26 +17,13 @@
;; CHECK-BIN: (type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
+ (import "env" "table" (table 9 9 funcref))
+
;; CHECK-TEXT: (type $2 (func))
;; CHECK-TEXT: (type $3 (func (param i32)))
;; CHECK-TEXT: (import "env" "table" (table $timport$0 9 9 funcref))
- ;; CHECK-BIN: (type $2 (func))
-
- ;; CHECK-BIN: (type $3 (func (param i32)))
-
- ;; CHECK-BIN: (import "env" "table" (table $timport$0 9 9 funcref))
- ;; CHECK-BIN-NODEBUG: (type $0 (func (result i32)))
-
- ;; CHECK-BIN-NODEBUG: (type $1 (func (param i32) (result i32)))
-
- ;; CHECK-BIN-NODEBUG: (type $2 (func))
-
- ;; CHECK-BIN-NODEBUG: (type $3 (func (param i32)))
-
- ;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 9 9 funcref))
- (import "env" "table" (table 9 9 funcref))
;; CHECK-TEXT: (func $break-and-binary (type $0) (result i32)
;; CHECK-TEXT-NEXT: (block $x (result i32)
@@ -53,6 +40,12 @@
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (type $2 (func))
+
+ ;; CHECK-BIN: (type $3 (func (param i32)))
+
+ ;; CHECK-BIN: (import "env" "table" (table $timport$0 9 9 funcref))
+
;; CHECK-BIN: (func $break-and-binary (type $0) (result i32)
;; CHECK-BIN-NEXT: (block $label$1 (result i32)
;; CHECK-BIN-NEXT: (unreachable)
@@ -371,6 +364,16 @@
)
)
)
+;; CHECK-BIN-NODEBUG: (type $0 (func (result i32)))
+
+;; CHECK-BIN-NODEBUG: (type $1 (func (param i32) (result i32)))
+
+;; CHECK-BIN-NODEBUG: (type $2 (func))
+
+;; CHECK-BIN-NODEBUG: (type $3 (func (param i32)))
+
+;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 9 9 funcref))
+
;; CHECK-BIN-NODEBUG: (func $0 (type $0) (result i32)
;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32)
;; CHECK-BIN-NODEBUG-NEXT: (unreachable)
diff --git a/test/lit/basic/reference-types.wast b/test/lit/basic/reference-types.wast
index 9a3a5c663..2b502d789 100644
--- a/test/lit/basic/reference-types.wast
+++ b/test/lit/basic/reference-types.wast
@@ -174,11 +174,7 @@
(import "env" "import_func" (func $import_func (param eqref) (result funcref)))
(import "env" "import_global" (global $import_global eqref))
- ;; CHECK-BIN-NODEBUG: (tag $tag$0 (param i32))
-
- ;; CHECK-BIN-NODEBUG: (export "export_func" (func $fimport$0))
(export "export_func" (func $import_func (param eqref) (result funcref)))
- ;; CHECK-BIN-NODEBUG: (export "export_global" (global $gimport$0))
(export "export_global" (global $import_global))
;; Test global initializer expressions
@@ -1846,6 +1842,12 @@
;; CHECK-BIN-NEXT: )
(func $ref-taken-but-not-in-table)
)
+;; CHECK-BIN-NODEBUG: (tag $tag$0 (param i32))
+
+;; CHECK-BIN-NODEBUG: (export "export_func" (func $fimport$0))
+
+;; CHECK-BIN-NODEBUG: (export "export_global" (global $gimport$0))
+
;; CHECK-BIN-NODEBUG: (func $0 (type $4) (param $0 eqref)
;; CHECK-BIN-NODEBUG-NEXT: (nop)
;; CHECK-BIN-NODEBUG-NEXT: )
diff --git a/test/lit/basic/table-import.wast b/test/lit/basic/table-import.wast
index 347da5634..79e6f6eeb 100644
--- a/test/lit/basic/table-import.wast
+++ b/test/lit/basic/table-import.wast
@@ -14,13 +14,16 @@
;; CHECK-BIN: (type $0 (func))
;; CHECK-BIN-NODEBUG: (type $0 (func))
(type $0 (func))
- ;; CHECK-TEXT: (import "env" "table" (table $timport$0 1 1 funcref))
- ;; CHECK-BIN: (import "env" "table" (table $timport$0 1 1 funcref))
- ;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 1 1 funcref))
(import "env" "table" (table 1 1 funcref))
(elem (i32.const 0) $foo)
+ ;; CHECK-TEXT: (import "env" "table" (table $timport$0 1 1 funcref))
+
;; CHECK-TEXT: (memory $0 0)
+ ;; CHECK-BIN: (import "env" "table" (table $timport$0 1 1 funcref))
+
;; CHECK-BIN: (memory $0 0)
+ ;; CHECK-BIN-NODEBUG: (import "env" "table" (table $timport$0 1 1 funcref))
+
;; CHECK-BIN-NODEBUG: (memory $0 0)
(memory $0 0)
diff --git a/test/lit/basic/tags.wast b/test/lit/basic/tags.wast
index e6c5d2ccc..5fbc0b811 100644
--- a/test/lit/basic/tags.wast
+++ b/test/lit/basic/tags.wast
@@ -56,13 +56,6 @@
(tag $e-export (export "ex0") (param i32))
(tag $e-import (import "env" "im0") (param i32))
- ;; CHECK-BIN-NODEBUG: (type $0 (func (param i32 f32)))
-
- ;; CHECK-BIN-NODEBUG: (type $1 (func (param i32)))
-
- ;; CHECK-BIN-NODEBUG: (type $2 (func))
-
- ;; CHECK-BIN-NODEBUG: (import "env" "im0" (tag $eimport$0 (param i32)))
(import "env" "im1" (tag (param i32 f32)))
;; CHECK-TEXT: (export "ex0" (tag $e-export))
@@ -70,22 +63,30 @@
;; CHECK-BIN: (export "ex0" (tag $e-export))
;; CHECK-BIN: (export "ex1" (tag $e))
- ;; CHECK-BIN-NODEBUG: (import "env" "im1" (tag $eimport$1 (param i32 f32)))
+ (export "ex1" (tag $e))
+)
+;; CHECK-BIN-NODEBUG: (type $0 (func (param i32 f32)))
- ;; CHECK-BIN-NODEBUG: (tag $tag$0 (param i32))
+;; CHECK-BIN-NODEBUG: (type $1 (func (param i32)))
- ;; CHECK-BIN-NODEBUG: (tag $tag$1 (param i32 f32))
+;; CHECK-BIN-NODEBUG: (type $2 (func))
- ;; CHECK-BIN-NODEBUG: (tag $tag$2)
+;; CHECK-BIN-NODEBUG: (import "env" "im0" (tag $eimport$0 (param i32)))
- ;; CHECK-BIN-NODEBUG: (tag $tag$3 (param i32 f32))
+;; CHECK-BIN-NODEBUG: (import "env" "im1" (tag $eimport$1 (param i32 f32)))
- ;; CHECK-BIN-NODEBUG: (tag $tag$4 (param i32 f32))
+;; CHECK-BIN-NODEBUG: (tag $tag$0 (param i32))
- ;; CHECK-BIN-NODEBUG: (tag $tag$5 (param i32))
+;; CHECK-BIN-NODEBUG: (tag $tag$1 (param i32 f32))
- ;; CHECK-BIN-NODEBUG: (export "ex0" (tag $tag$5))
+;; CHECK-BIN-NODEBUG: (tag $tag$2)
- ;; CHECK-BIN-NODEBUG: (export "ex1" (tag $tag$1))
- (export "ex1" (tag $e))
-)
+;; CHECK-BIN-NODEBUG: (tag $tag$3 (param i32 f32))
+
+;; CHECK-BIN-NODEBUG: (tag $tag$4 (param i32 f32))
+
+;; CHECK-BIN-NODEBUG: (tag $tag$5 (param i32))
+
+;; CHECK-BIN-NODEBUG: (export "ex0" (tag $tag$5))
+
+;; CHECK-BIN-NODEBUG: (export "ex1" (tag $tag$1))
diff --git a/test/lit/basic/unit.wat b/test/lit/basic/unit.wat
index 8392a2269..4fc36b3b7 100644
--- a/test/lit/basic/unit.wat
+++ b/test/lit/basic/unit.wat
@@ -64,20 +64,23 @@
(type $9 (func (param i32 i64)))
;; CHECK-TEXT: (import "env" "_emscripten_asm_const_vi" (func $_emscripten_asm_const_vi (type $FUNCSIG$v)))
;; CHECK-BIN: (import "env" "_emscripten_asm_const_vi" (func $_emscripten_asm_const_vi (type $FUNCSIG$v)))
- ;; CHECK-BIN-NODEBUG: (import "env" "_emscripten_asm_const_vi" (func $fimport$0 (type $1)))
(import "env" "_emscripten_asm_const_vi" (func $_emscripten_asm_const_vi))
;; CHECK-TEXT: (import "asm2wasm" "f64-to-int" (func $f64-to-int (type $FUNCSIG$id) (param f64) (result i32)))
;; CHECK-BIN: (import "asm2wasm" "f64-to-int" (func $f64-to-int (type $FUNCSIG$id) (param f64) (result i32)))
- ;; CHECK-BIN-NODEBUG: (import "asm2wasm" "f64-to-int" (func $fimport$1 (type $5) (param f64) (result i32)))
(import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32)))
;; CHECK-TEXT: (import "asm2wasm" "f64-rem" (func $f64-rem (type $FUNCSIG$ddd) (param f64 f64) (result f64)))
;; CHECK-BIN: (import "asm2wasm" "f64-rem" (func $f64-rem (type $FUNCSIG$ddd) (param f64 f64) (result f64)))
- ;; CHECK-BIN-NODEBUG: (import "asm2wasm" "f64-rem" (func $fimport$2 (type $4) (param f64 f64) (result f64)))
(import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64)))
(table 10 funcref)
(elem (i32.const 0) $z $big_negative $z $z $w $w $importedDoubles $w $z $cneg)
;; CHECK-TEXT: (memory $0 4096 4096)
;; CHECK-BIN: (memory $0 4096 4096)
+ ;; CHECK-BIN-NODEBUG: (import "env" "_emscripten_asm_const_vi" (func $fimport$0 (type $1)))
+
+ ;; CHECK-BIN-NODEBUG: (import "asm2wasm" "f64-to-int" (func $fimport$1 (type $5) (param f64) (result i32)))
+
+ ;; CHECK-BIN-NODEBUG: (import "asm2wasm" "f64-rem" (func $fimport$2 (type $4) (param f64 f64) (result f64)))
+
;; CHECK-BIN-NODEBUG: (memory $0 4096 4096)
(memory $0 4096 4096)
(data (i32.const 1026) "\14\00")
@@ -95,13 +98,6 @@
;; CHECK-BIN: (elem $0 (i32.const 0) $z $big_negative $z $z $w $w $importedDoubles $w $z $cneg)
;; CHECK-BIN: (export "big_negative" (func $big_negative))
- ;; CHECK-BIN-NODEBUG: (data $0 (i32.const 1026) "\14\00")
-
- ;; CHECK-BIN-NODEBUG: (table $0 10 funcref)
-
- ;; CHECK-BIN-NODEBUG: (elem $0 (i32.const 0) $17 $0 $17 $17 $18 $18 $1 $18 $17 $15)
-
- ;; CHECK-BIN-NODEBUG: (export "big_negative" (func $0))
(export "big_negative" (func $big_negative))
;; CHECK-TEXT: (func $big_negative (type $FUNCSIG$v)
;; CHECK-TEXT-NEXT: (local $temp f64)
@@ -1743,6 +1739,14 @@
)
)
)
+;; CHECK-BIN-NODEBUG: (data $0 (i32.const 1026) "\14\00")
+
+;; CHECK-BIN-NODEBUG: (table $0 10 funcref)
+
+;; CHECK-BIN-NODEBUG: (elem $0 (i32.const 0) $17 $0 $17 $17 $18 $18 $1 $18 $17 $15)
+
+;; CHECK-BIN-NODEBUG: (export "big_negative" (func $0))
+
;; CHECK-BIN-NODEBUG: (func $0 (type $1)
;; CHECK-BIN-NODEBUG-NEXT: (local $0 f64)
;; CHECK-BIN-NODEBUG-NEXT: (local.set $0
diff --git a/test/lit/ctor-eval/ctor_after_serialization.wat b/test/lit/ctor-eval/ctor_after_serialization.wat
index 45e811804..df37f7e8b 100644
--- a/test/lit/ctor-eval/ctor_after_serialization.wat
+++ b/test/lit/ctor-eval/ctor_after_serialization.wat
@@ -10,15 +10,7 @@
;; CHECK: (type $A (struct ))
(type $A (struct))
- ;; CHECK: (type $1 (func (result (ref any))))
-
- ;; CHECK: (type $2 (func))
-
- ;; CHECK: (global $ctor-eval$global (ref $A) (struct.new_default $A))
-
- ;; CHECK: (export "new" (func $new_2))
(export "new" (func $new))
- ;; CHECK: (export "nop" (func $nop_3))
(export "nop" (func $nop))
(func $new (result (ref any))
@@ -30,6 +22,16 @@
)
)
+;; CHECK: (type $1 (func (result (ref any))))
+
+;; CHECK: (type $2 (func))
+
+;; CHECK: (global $ctor-eval$global (ref $A) (struct.new_default $A))
+
+;; CHECK: (export "new" (func $new_2))
+
+;; CHECK: (export "nop" (func $nop_3))
+
;; CHECK: (func $new_2 (type $1) (result (ref any))
;; CHECK-NEXT: (global.get $ctor-eval$global)
;; CHECK-NEXT: )
@@ -53,11 +55,7 @@
(struct.new_default $A)
)
- ;; CHECK: (global $ctor-eval$global_1 (ref $A) (struct.new_default $A))
-
- ;; CHECK: (export "new" (func $new_2))
(export "new" (func $new))
- ;; CHECK: (export "nop" (func $nop_3))
(export "nop" (func $nop))
(func $new (result (ref any))
@@ -69,6 +67,12 @@
(global.get $ctor-eval$global)
)
)
+;; CHECK: (global $ctor-eval$global_1 (ref $A) (struct.new_default $A))
+
+;; CHECK: (export "new" (func $new_2))
+
+;; CHECK: (export "nop" (func $nop_3))
+
;; CHECK: (func $new_2 (type $1) (result (ref any))
;; CHECK-NEXT: (global.get $ctor-eval$global_1)
;; CHECK-NEXT: )
diff --git a/test/lit/ctor-eval/extern.wast b/test/lit/ctor-eval/extern.wast
index 5bb5c8cbc..9a8779abf 100644
--- a/test/lit/ctor-eval/extern.wast
+++ b/test/lit/ctor-eval/extern.wast
@@ -8,29 +8,8 @@
;; CHECK: (type $struct (struct (field externref)))
(type $struct (struct (field externref)))
- ;; CHECK: (type $2 (func (result externref)))
-
- ;; CHECK: (type $3 (func (result anyref)))
-
- ;; CHECK: (global $ctor-eval$global (ref $array) (array.new_fixed $array 3
- ;; CHECK-NEXT: (i32.const 1)
- ;; CHECK-NEXT: (i32.const 2)
- ;; CHECK-NEXT: (i32.const 3)
- ;; CHECK-NEXT: ))
-
- ;; CHECK: (global $ctor-eval$global_1 (ref $struct) (struct.new $struct
- ;; CHECK-NEXT: (extern.externalize
- ;; CHECK-NEXT: (ref.i31
- ;; CHECK-NEXT: (i32.const 1)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: ))
-
- ;; CHECK: (export "test1" (func $test1_3))
(export "test1" (func $test1))
- ;; CHECK: (export "test2" (func $test2_4))
(export "test2" (func $test2))
- ;; CHECK: (export "test3" (func $test3_5))
(export "test3" (func $test3))
(func $test1 (result externref)
@@ -70,6 +49,30 @@
)
)
+;; CHECK: (type $2 (func (result externref)))
+
+;; CHECK: (type $3 (func (result anyref)))
+
+;; CHECK: (global $ctor-eval$global (ref $array) (array.new_fixed $array 3
+;; CHECK-NEXT: (i32.const 1)
+;; CHECK-NEXT: (i32.const 2)
+;; CHECK-NEXT: (i32.const 3)
+;; CHECK-NEXT: ))
+
+;; CHECK: (global $ctor-eval$global_1 (ref $struct) (struct.new $struct
+;; CHECK-NEXT: (extern.externalize
+;; CHECK-NEXT: (ref.i31
+;; CHECK-NEXT: (i32.const 1)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: ))
+
+;; CHECK: (export "test1" (func $test1_3))
+
+;; CHECK: (export "test2" (func $test2_4))
+
+;; CHECK: (export "test3" (func $test3_5))
+
;; CHECK: (func $test1_3 (type $2) (result externref)
;; CHECK-NEXT: (extern.externalize
;; CHECK-NEXT: (ref.i31
diff --git a/test/lit/ctor-eval/table.wat b/test/lit/ctor-eval/table.wat
index 73534f59b..0954faeea 100644
--- a/test/lit/ctor-eval/table.wat
+++ b/test/lit/ctor-eval/table.wat
@@ -10,11 +10,6 @@
(elem (i32.const 0) $nop)
- ;; CHECK: (elem $0 (i32.const 0) $nop)
-
- ;; CHECK: (elem declare func $trap)
-
- ;; CHECK: (export "run" (func $run_3))
(export "run" (func $run))
(func $run (type $none_=>_none)
@@ -35,6 +30,12 @@
)
)
+ ;; CHECK: (elem $0 (i32.const 0) $nop)
+
+ ;; CHECK: (elem declare func $trap)
+
+ ;; CHECK: (export "run" (func $run_3))
+
;; CHECK: (func $nop (type $none_=>_none)
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
diff --git a/test/lit/ctor-eval/v128.wast b/test/lit/ctor-eval/v128.wast
index 03a7bb9d8..009ef57f2 100644
--- a/test/lit/ctor-eval/v128.wast
+++ b/test/lit/ctor-eval/v128.wast
@@ -9,10 +9,11 @@
;; CHECK: (memory $0 (shared 16 17))
(memory $0 (shared 16 17))
+ (export "v128" (func $v128))
;; CHECK: (data $0 (i32.const 23) "\e0\ff\c0N\8e\00\00\fe\01\00\12\81\85\fd\ff\90")
;; CHECK: (export "v128" (func $v128_2))
- (export "v128" (func $v128))
+
;; CHECK: (export "keepalive" (func $keepalive))
(export "keepalive" (func $keepalive))
diff --git a/test/lit/passes/generate-dyncalls_all-features.wast b/test/lit/passes/generate-dyncalls_all-features.wast
index 34c387b08..99611727b 100644
--- a/test/lit/passes/generate-dyncalls_all-features.wast
+++ b/test/lit/passes/generate-dyncalls_all-features.wast
@@ -73,8 +73,9 @@
;; CHECK: (type $3 (func (param i32 i32)))
;; CHECK: (import "env" "table" (table $timport$0 1 1 funcref))
- (import "env" "invoke_vii" (func $invoke_vii (param i32 i32 i32)))
+
;; CHECK: (import "env" "invoke_vii" (func $invoke_vii (type $0) (param i32 i32 i32)))
+ (import "env" "invoke_vii" (func $invoke_vii (param i32 i32 i32)))
(import "env" "table" (table 1 1 funcref))
(elem (i32.const 0) $f)
;; CHECK: (elem $0 (i32.const 0) $f)
diff --git a/test/lit/passes/gufa.wast b/test/lit/passes/gufa.wast
index 58166cd46..b97e620ab 100644
--- a/test/lit/passes/gufa.wast
+++ b/test/lit/passes/gufa.wast
@@ -583,6 +583,8 @@
(ref.func $reffed)
)
+ (export "table" (table 0))
+
;; CHECK: (type $1 (func))
;; CHECK: (table $0 10 funcref)
@@ -590,7 +592,6 @@
;; CHECK: (elem $0 (i32.const 0) $reffed)
;; CHECK: (export "table" (table $0))
- (export "table" (table 0))
;; CHECK: (func $reffed (type $i) (param $x i32)
;; CHECK-NEXT: (drop
@@ -924,6 +925,12 @@
;; CHECK: (type $A (func (param i32)))
(type $A (func (param i32)))
+ (import "binaryen-intrinsics" "call.without.effects"
+ (func $call-without-effects (param i32 funcref)))
+
+ (import "other" "import"
+ (func $other-import (param funcref)))
+
;; CHECK: (type $1 (func (param i32 funcref)))
;; CHECK: (type $2 (func (param funcref)))
@@ -931,12 +938,8 @@
;; CHECK: (type $3 (func))
;; CHECK: (import "binaryen-intrinsics" "call.without.effects" (func $call-without-effects (type $1) (param i32 funcref)))
- (import "binaryen-intrinsics" "call.without.effects"
- (func $call-without-effects (param i32 funcref)))
;; CHECK: (import "other" "import" (func $other-import (type $2) (param funcref)))
- (import "other" "import"
- (func $other-import (param funcref)))
;; CHECK: (elem declare func $target-drop $target-keep)
@@ -994,6 +997,12 @@
;; CHECK: (type $A (func (param i32)))
(type $A (func (param i32)))
+ (import "binaryen-intrinsics" "call.without.effects"
+ (func $call-without-effects (param i32 funcref)))
+
+ (import "other" "import"
+ (func $other-import (param funcref)))
+
;; CHECK: (type $1 (func (param i32 funcref)))
;; CHECK: (type $2 (func (param funcref)))
@@ -1001,12 +1010,8 @@
;; CHECK: (type $3 (func (param (ref null $A))))
;; CHECK: (import "binaryen-intrinsics" "call.without.effects" (func $call-without-effects (type $1) (param i32 funcref)))
- (import "binaryen-intrinsics" "call.without.effects"
- (func $call-without-effects (param i32 funcref)))
;; CHECK: (import "other" "import" (func $other-import (type $2) (param funcref)))
- (import "other" "import"
- (func $other-import (param funcref)))
;; CHECK: (elem declare func $target-keep $target-keep-2)
diff --git a/test/lit/passes/inlining-optimizing_optimize-level=3.wast b/test/lit/passes/inlining-optimizing_optimize-level=3.wast
index dfdbed533..a0e320bd6 100644
--- a/test/lit/passes/inlining-optimizing_optimize-level=3.wast
+++ b/test/lit/passes/inlining-optimizing_optimize-level=3.wast
@@ -33,54 +33,58 @@
;; CHECK: (type $11 (func (param i32 i32 i32 i32 i32)))
;; CHECK: (import "env" "memory" (memory $0 256 256))
- (import "env" "STACKTOP" (global $STACKTOP$asm2wasm$import i32))
+
;; CHECK: (import "env" "table" (table $timport$0 18 18 funcref))
- (import "env" "STACK_MAX" (global $STACK_MAX$asm2wasm$import i32))
+
;; CHECK: (import "env" "STACKTOP" (global $STACKTOP$asm2wasm$import i32))
- (import "env" "tempDoublePtr" (global $tempDoublePtr$asm2wasm$import i32))
+ (import "env" "STACKTOP" (global $STACKTOP$asm2wasm$import i32))
;; CHECK: (import "env" "STACK_MAX" (global $STACK_MAX$asm2wasm$import i32))
- (import "env" "abort" (func $abort))
+ (import "env" "STACK_MAX" (global $STACK_MAX$asm2wasm$import i32))
;; CHECK: (import "env" "tempDoublePtr" (global $tempDoublePtr$asm2wasm$import i32))
- (import "env" "nullFunc_ii" (func $nullFunc_ii (param i32)))
+ (import "env" "tempDoublePtr" (global $tempDoublePtr$asm2wasm$import i32))
;; CHECK: (import "env" "memoryBase" (global $memoryBase i32))
- (import "env" "nullFunc_iiii" (func $nullFunc_iiii (param i32)))
+
;; CHECK: (import "env" "tableBase" (global $tableBase i32))
- (import "env" "nullFunc_vi" (func $nullFunc_vi (param i32)))
+
;; CHECK: (import "env" "abort" (func $abort))
- (import "env" "_pthread_cleanup_pop" (func $_pthread_cleanup_pop (param i32)))
+ (import "env" "abort" (func $abort))
;; CHECK: (import "env" "nullFunc_ii" (func $nullFunc_ii (param i32)))
- (import "env" "___lock" (func $___lock (param i32)))
+ (import "env" "nullFunc_ii" (func $nullFunc_ii (param i32)))
;; CHECK: (import "env" "nullFunc_iiii" (func $nullFunc_iiii (param i32)))
- (import "env" "_pthread_self" (func $_pthread_self (result i32)))
+ (import "env" "nullFunc_iiii" (func $nullFunc_iiii (param i32)))
;; CHECK: (import "env" "nullFunc_vi" (func $nullFunc_vi (param i32)))
- (import "env" "_abort" (func $_abort))
+ (import "env" "nullFunc_vi" (func $nullFunc_vi (param i32)))
;; CHECK: (import "env" "_pthread_cleanup_pop" (func $_pthread_cleanup_pop (param i32)))
- (import "env" "___syscall6" (func $___syscall6 (param i32 i32) (result i32)))
+ (import "env" "_pthread_cleanup_pop" (func $_pthread_cleanup_pop (param i32)))
;; CHECK: (import "env" "___lock" (func $___lock (param i32)))
- (import "env" "_sbrk" (func $_sbrk (param i32) (result i32)))
+ (import "env" "___lock" (func $___lock (param i32)))
;; CHECK: (import "env" "_pthread_self" (func $_pthread_self (result i32)))
- (import "env" "_time" (func $_time (param i32) (result i32)))
+ (import "env" "_pthread_self" (func $_pthread_self (result i32)))
;; CHECK: (import "env" "_abort" (func $_abort))
- (import "env" "_emscripten_memcpy_big" (func $_emscripten_memcpy_big (param i32 i32 i32) (result i32)))
+ (import "env" "_abort" (func $_abort))
;; CHECK: (import "env" "___syscall6" (func $___syscall6 (param i32 i32) (result i32)))
- (import "env" "___syscall54" (func $___syscall54 (param i32 i32) (result i32)))
+ (import "env" "___syscall6" (func $___syscall6 (param i32 i32) (result i32)))
;; CHECK: (import "env" "_sbrk" (func $_sbrk (param i32) (result i32)))
- (import "env" "___unlock" (func $___unlock (param i32)))
+ (import "env" "_sbrk" (func $_sbrk (param i32) (result i32)))
;; CHECK: (import "env" "_time" (func $_time (param i32) (result i32)))
- (import "env" "___syscall140" (func $___syscall140 (param i32 i32) (result i32)))
+ (import "env" "_time" (func $_time (param i32) (result i32)))
;; CHECK: (import "env" "_emscripten_memcpy_big" (func $_emscripten_memcpy_big (param i32 i32 i32) (result i32)))
- (import "env" "_pthread_cleanup_push" (func $_pthread_cleanup_push (param i32 i32)))
+ (import "env" "_emscripten_memcpy_big" (func $_emscripten_memcpy_big (param i32 i32 i32) (result i32)))
;; CHECK: (import "env" "___syscall54" (func $___syscall54 (param i32 i32) (result i32)))
- (import "env" "_sysconf" (func $_sysconf (param i32) (result i32)))
+ (import "env" "___syscall54" (func $___syscall54 (param i32 i32) (result i32)))
;; CHECK: (import "env" "___unlock" (func $___unlock (param i32)))
- (import "env" "___syscall146" (func $___syscall146 (param i32 i32) (result i32)))
+ (import "env" "___unlock" (func $___unlock (param i32)))
;; CHECK: (import "env" "___syscall140" (func $___syscall140 (param i32 i32) (result i32)))
- (import "env" "memory" (memory $0 256 256))
+ (import "env" "___syscall140" (func $___syscall140 (param i32 i32) (result i32)))
;; CHECK: (import "env" "_pthread_cleanup_push" (func $_pthread_cleanup_push (param i32 i32)))
- (import "env" "table" (table 18 18 funcref))
+ (import "env" "_pthread_cleanup_push" (func $_pthread_cleanup_push (param i32 i32)))
;; CHECK: (import "env" "_sysconf" (func $_sysconf (param i32) (result i32)))
- (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "_sysconf" (func $_sysconf (param i32) (result i32)))
;; CHECK: (import "env" "___syscall146" (func $___syscall146 (param i32 i32) (result i32)))
+ (import "env" "___syscall146" (func $___syscall146 (param i32 i32) (result i32)))
+ (import "env" "memory" (memory $0 256 256))
+ (import "env" "table" (table 18 18 funcref))
+ (import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
;; CHECK: (global $STACKTOP (mut i32) (global.get $STACKTOP$asm2wasm$import))
(global $STACKTOP (mut i32) (global.get $STACKTOP$asm2wasm$import))
diff --git a/test/lit/passes/jspi-args.wast b/test/lit/passes/jspi-args.wast
index 1a23c1716..8229e34e9 100644
--- a/test/lit/passes/jspi-args.wast
+++ b/test/lit/passes/jspi-args.wast
@@ -3,18 +3,20 @@
(module
;; sleep_async should have a wrapper function built.
+ (import "js" "sleep_async" (func $sleep_async (param f64) (result i32)))
;; CHECK: (type $0 (func (param f64) (result i32)))
;; CHECK: (type $1 (func (param externref f64) (result i32)))
;; CHECK: (import "js" "sleep_sync" (func $sleep_sync (type $0) (param f64) (result i32)))
- (import "js" "sleep_async" (func $sleep_async (param f64) (result i32)))
- ;; CHECK: (import "js" "sleep_async" (func $import$sleep_async (type $1) (param externref f64) (result i32)))
(import "js" "sleep_sync" (func $sleep_sync (param f64) (result i32)))
+ (export "update_state_async" (func $update_state_async))
+ ;; CHECK: (import "js" "sleep_async" (func $import$sleep_async (type $1) (param externref f64) (result i32)))
+
;; CHECK: (global $suspender (mut externref) (ref.null noextern))
;; CHECK: (export "update_state_async" (func $export$update_state_async))
- (export "update_state_async" (func $update_state_async))
+
;; CHECK: (export "update_state_sync" (func $update_state_sync))
(export "update_state_sync" (func $update_state_sync))
;; This function calls an async sleep so a wrapper should be created for it.
diff --git a/test/lit/passes/jspi-table.wast b/test/lit/passes/jspi-table.wast
index 526b0a4b7..c702357c0 100644
--- a/test/lit/passes/jspi-table.wast
+++ b/test/lit/passes/jspi-table.wast
@@ -12,10 +12,11 @@
;; CHECK: (table $0 1 1 funcref)
(table $0 1 1 funcref)
(elem (i32.const 1) func $update_state)
+ (export "update_state" (func $update_state))
+
;; CHECK: (elem $0 (i32.const 1) $export$update_state)
;; CHECK: (export "update_state" (func $export$update_state))
- (export "update_state" (func $update_state))
;; CHECK: (func $update_state (type $0) (param $param f64) (result i32)
;; CHECK-NEXT: (i32.const 42)
diff --git a/test/lit/passes/jspi.wast b/test/lit/passes/jspi.wast
index 780a54ccb..12396cc6d 100644
--- a/test/lit/passes/jspi.wast
+++ b/test/lit/passes/jspi.wast
@@ -4,6 +4,19 @@
(module
+ (import "js" "compute_delta" (func $compute_delta (param f64) (result i32)))
+ (import "js" "import_and_export" (func $import_and_export (param i32) (result i32)))
+ (import "js" "import_void_return" (func $import_void_return (param i32)))
+ (export "update_state_void" (func $update_state_void))
+ (export "update_state" (func $update_state))
+ ;; Test duplicating an export.
+ (export "update_state_again" (func $update_state))
+ ;; Test that a name collision on the parameters is handled.
+ (export "update_state_param_collision" (func $update_state_param_collision))
+ ;; Test function that is imported and exported.
+ (export "import_and_export" (func $import_and_export))
+
+
;; CHECK: (type $0 (func (param externref f64) (result i32)))
;; CHECK: (type $1 (func (param f64) (result i32)))
@@ -19,27 +32,22 @@
;; CHECK: (type $6 (func (param externref i32)))
;; CHECK: (import "js" "compute_delta" (func $import$compute_delta (type $0) (param externref f64) (result i32)))
- (import "js" "compute_delta" (func $compute_delta (param f64) (result i32)))
+
;; CHECK: (import "js" "import_and_export" (func $import$import_and_export (type $2) (param externref i32) (result i32)))
- (import "js" "import_and_export" (func $import_and_export (param i32) (result i32)))
+
;; CHECK: (import "js" "import_void_return" (func $import$import_void_return (type $6) (param externref i32)))
- (import "js" "import_void_return" (func $import_void_return (param i32)))
+
;; CHECK: (global $suspender (mut externref) (ref.null noextern))
;; CHECK: (export "update_state_void" (func $export$update_state_void))
- (export "update_state_void" (func $update_state_void))
+
;; CHECK: (export "update_state" (func $export$update_state))
- (export "update_state" (func $update_state))
- ;; Test duplicating an export.
+
;; CHECK: (export "update_state_again" (func $export$update_state))
- (export "update_state_again" (func $update_state))
- ;; Test that a name collision on the parameters is handled.
+
;; CHECK: (export "update_state_param_collision" (func $export$update_state_param_collision))
- (export "update_state_param_collision" (func $update_state_param_collision))
- ;; Test function that is imported and exported.
- ;; CHECK: (export "import_and_export" (func $export$import_and_export))
- (export "import_and_export" (func $import_and_export))
+ ;; CHECK: (export "import_and_export" (func $export$import_and_export))
;; CHECK: (func $update_state (type $1) (param $param f64) (result i32)
;; CHECK-NEXT: (call $compute_delta
diff --git a/test/lit/passes/legalize-js-interface-exported-helpers.wast b/test/lit/passes/legalize-js-interface-exported-helpers.wast
index 35271ee84..707cbe5c9 100644
--- a/test/lit/passes/legalize-js-interface-exported-helpers.wast
+++ b/test/lit/passes/legalize-js-interface-exported-helpers.wast
@@ -6,6 +6,10 @@
;; RUN: wasm-opt %s --legalize-js-interface --pass-arg=legalize-js-interface-exported-helpers -S -o - | filecheck %s
(module
+ (export "get_i64" (func $get_i64))
+ (import "env" "imported" (func $imported (result i64)))
+ (export "__set_temp_ret" (func $__set_temp_ret))
+ (export "__get_temp_ret" (func $__get_temp_ret))
;; CHECK: (type $0 (func (result i32)))
;; CHECK: (type $1 (func (result i64)))
@@ -15,10 +19,7 @@
;; CHECK: (import "env" "imported" (func $legalimport$imported (result i32)))
;; CHECK: (export "get_i64" (func $legalstub$get_i64))
- (export "get_i64" (func $get_i64))
- (import "env" "imported" (func $imported (result i64)))
- (export "__set_temp_ret" (func $__set_temp_ret))
- (export "__get_temp_ret" (func $__get_temp_ret))
+
;; CHECK: (func $get_i64 (result i64)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (call $legalfunc$imported)
diff --git a/test/lit/passes/legalize-js-interface-minimally.wast b/test/lit/passes/legalize-js-interface-minimally.wast
index 76bed505c..664b024b3 100644
--- a/test/lit/passes/legalize-js-interface-minimally.wast
+++ b/test/lit/passes/legalize-js-interface-minimally.wast
@@ -16,14 +16,16 @@
;; CHECK: (import "env" "imported" (func $imported (result i64)))
(import "env" "imported" (func $imported (result i64)))
- ;; CHECK: (import "env" "setTempRet0" (func $setTempRet0 (param i32)))
(import "env" "invoke_vj" (func $invoke_vj (param i64)))
+ ;; CHECK: (import "env" "setTempRet0" (func $setTempRet0 (param i32)))
+
;; CHECK: (import "env" "invoke_vj" (func $legalimport$invoke_vj (param i32 i32)))
;; CHECK: (export "func" (func $func))
(export "func" (func $func))
- ;; CHECK: (export "dynCall_foo" (func $legalstub$dyn))
(export "dynCall_foo" (func $dyn))
+ ;; CHECK: (export "dynCall_foo" (func $legalstub$dyn))
+
;; CHECK: (func $func (result i64)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (call $imported)
diff --git a/test/lit/passes/legalize-js-interface_all-features.wast b/test/lit/passes/legalize-js-interface_all-features.wast
index 6afd2bc20..611a58da7 100644
--- a/test/lit/passes/legalize-js-interface_all-features.wast
+++ b/test/lit/passes/legalize-js-interface_all-features.wast
@@ -4,6 +4,10 @@
;; RUN: foreach %s %t wasm-opt --legalize-js-interface --all-features -S -o - | filecheck %s
(module
+ (import "env" "imported" (func $imported (result i64)))
+ (import "env" "other" (func $other (param i32) (param i64) (param i64)))
+ (import "env" "ref-func-arg" (func $ref-func-arg (result i64)))
+ (export "func" (func $func))
;; CHECK: (type $0 (func (result i32)))
;; CHECK: (type $1 (func (result i64)))
@@ -17,11 +21,11 @@
;; CHECK: (type $5 (func (param i32 i64 i64)))
;; CHECK: (import "env" "setTempRet0" (func $setTempRet0 (type $4) (param i32)))
- (import "env" "imported" (func $imported (result i64)))
+
;; CHECK: (import "env" "getTempRet0" (func $getTempRet0 (type $0) (result i32)))
- (import "env" "other" (func $other (param i32) (param i64) (param i64)))
+
;; CHECK: (import "env" "imported" (func $legalimport$imported (type $0) (result i32)))
- (import "env" "ref-func-arg" (func $ref-func-arg (result i64)))
+
;; CHECK: (import "env" "other" (func $legalimport$other (type $2) (param i32 i32 i32 i32 i32)))
;; CHECK: (import "env" "ref-func-arg" (func $legalimport$ref-func-arg (type $0) (result i32)))
@@ -29,15 +33,18 @@
;; CHECK: (elem declare func $legalfunc$ref-func-arg)
;; CHECK: (export "func" (func $legalstub$func))
- (export "func" (func $func))
+
;; CHECK: (export "ref-func-test" (func $ref-func-test))
(export "ref-func-test" (func $ref-func-test))
- ;; CHECK: (export "imported" (func $legalstub$imported))
(export "imported" (func $imported))
- ;; CHECK: (export "imported_again" (func $legalstub$imported))
(export "imported_again" (func $imported))
- ;; CHECK: (export "other" (func $legalstub$other))
(export "other" (func $other))
+ ;; CHECK: (export "imported" (func $legalstub$imported))
+
+ ;; CHECK: (export "imported_again" (func $legalstub$imported))
+
+ ;; CHECK: (export "other" (func $legalstub$other))
+
;; CHECK: (func $func (type $1) (result i64)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (call $legalfunc$imported)
diff --git a/test/lit/passes/legalize-js-interface_pass-arg=legalize-js-interface-export-originals.wast b/test/lit/passes/legalize-js-interface_pass-arg=legalize-js-interface-export-originals.wast
index ba9db7ee5..f56db7982 100644
--- a/test/lit/passes/legalize-js-interface_pass-arg=legalize-js-interface-export-originals.wast
+++ b/test/lit/passes/legalize-js-interface_pass-arg=legalize-js-interface-export-originals.wast
@@ -13,9 +13,9 @@
;; CHECK: (import "env" "setTempRet0" (func $setTempRet0 (param i32)))
;; CHECK: (export "func" (func $legalstub$func))
- (export "func" (func $func))
- ;; CHECK: (export "orig$func" (func $func))
+ ;; CHECK: (export "orig$func" (func $func))
+ (export "func" (func $func))
;; CHECK: (func $func (result i64)
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
diff --git a/test/lit/passes/remove-unused-module-elements-refs.wast b/test/lit/passes/remove-unused-module-elements-refs.wast
index 00ea9767f..44c87fefc 100644
--- a/test/lit/passes/remove-unused-module-elements-refs.wast
+++ b/test/lit/passes/remove-unused-module-elements-refs.wast
@@ -469,20 +469,18 @@
;; OPEN_WORLD: (type $A (func))
(type $A (func))
- ;; CHECK: (type $1 (func (param funcref)))
-
- ;; CHECK: (import "binaryen-intrinsics" "call.without.effects" (func $call-without-effects (type $1) (param funcref)))
- ;; OPEN_WORLD: (type $1 (func (param funcref)))
-
- ;; OPEN_WORLD: (import "binaryen-intrinsics" "call.without.effects" (func $call-without-effects (type $1) (param funcref)))
(import "binaryen-intrinsics" "call.without.effects"
(func $call-without-effects (param funcref)))
- ;; CHECK: (import "other" "import" (func $other-import (type $1) (param funcref)))
- ;; OPEN_WORLD: (import "other" "import" (func $other-import (type $1) (param funcref)))
(import "other" "import"
(func $other-import (param funcref)))
+ ;; CHECK: (type $1 (func (param funcref)))
+
+ ;; CHECK: (import "binaryen-intrinsics" "call.without.effects" (func $call-without-effects (type $1) (param funcref)))
+
+ ;; CHECK: (import "other" "import" (func $other-import (type $1) (param funcref)))
+
;; CHECK: (elem declare func $target-drop $target-keep)
;; CHECK: (export "foo" (func $foo))
@@ -495,6 +493,12 @@
;; CHECK-NEXT: (ref.func $target-drop)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
+ ;; OPEN_WORLD: (type $1 (func (param funcref)))
+
+ ;; OPEN_WORLD: (import "binaryen-intrinsics" "call.without.effects" (func $call-without-effects (type $1) (param funcref)))
+
+ ;; OPEN_WORLD: (import "other" "import" (func $other-import (type $1) (param funcref)))
+
;; OPEN_WORLD: (elem declare func $target-drop $target-keep)
;; OPEN_WORLD: (export "foo" (func $foo))
@@ -546,20 +550,18 @@
;; OPEN_WORLD: (type $A (func))
(type $A (func))
- ;; CHECK: (type $1 (func (param funcref)))
-
- ;; CHECK: (import "binaryen-intrinsics" "call.without.effects" (func $call-without-effects (type $1) (param funcref)))
- ;; OPEN_WORLD: (type $1 (func (param funcref)))
-
- ;; OPEN_WORLD: (import "binaryen-intrinsics" "call.without.effects" (func $call-without-effects (type $1) (param funcref)))
(import "binaryen-intrinsics" "call.without.effects"
(func $call-without-effects (param funcref)))
- ;; CHECK: (import "other" "import" (func $other-import (type $1) (param funcref)))
- ;; OPEN_WORLD: (import "other" "import" (func $other-import (type $1) (param funcref)))
(import "other" "import"
(func $other-import (param funcref)))
+ ;; CHECK: (type $1 (func (param funcref)))
+
+ ;; CHECK: (import "binaryen-intrinsics" "call.without.effects" (func $call-without-effects (type $1) (param funcref)))
+
+ ;; CHECK: (import "other" "import" (func $other-import (type $1) (param funcref)))
+
;; CHECK: (elem declare func $target-keep $target-keep-2)
;; CHECK: (export "foo" (func $foo))
@@ -576,6 +578,12 @@
;; CHECK-NEXT: (ref.func $target-keep-2)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
+ ;; OPEN_WORLD: (type $1 (func (param funcref)))
+
+ ;; OPEN_WORLD: (import "binaryen-intrinsics" "call.without.effects" (func $call-without-effects (type $1) (param funcref)))
+
+ ;; OPEN_WORLD: (import "other" "import" (func $other-import (type $1) (param funcref)))
+
;; OPEN_WORLD: (elem declare func $target-keep $target-keep-2)
;; OPEN_WORLD: (export "foo" (func $foo))
diff --git a/test/lit/passes/remove-unused-module-elements_all-features.wast b/test/lit/passes/remove-unused-module-elements_all-features.wast
index 385433189..15a843064 100644
--- a/test/lit/passes/remove-unused-module-elements_all-features.wast
+++ b/test/lit/passes/remove-unused-module-elements_all-features.wast
@@ -175,11 +175,11 @@
(elem (table $1) (offset (i32.const 1)) func)
)
(module ;; remove the first table and memory, but not the second one
+ (import "env" "memory" (memory $0 256))
+ (import "env" "table" (table 0 funcref))
;; CHECK: (type $0 (func))
;; CHECK: (import "env" "table2" (table $1 1 1 funcref))
- (import "env" "memory" (memory $0 256))
- (import "env" "table" (table 0 funcref))
(import "env" "table2" (table $1 1 1 funcref))
(elem (table $1) (offset (i32.const 0)) func)
(elem (table $1) (offset (i32.const 0)) func $f)
@@ -203,22 +203,25 @@
(module ;; but not when exported
;; CHECK: (import "env" "memory" (memory $0 256))
(import "env" "memory" (memory $0 256))
- ;; CHECK: (import "env" "table" (table $timport$0 1 funcref))
(import "env" "table" (table 1 funcref))
- ;; CHECK: (export "mem" (memory $0))
(export "mem" (memory 0))
- ;; CHECK: (export "tab" (table $timport$0))
(export "tab" (table 0))
)
+;; CHECK: (import "env" "table" (table $timport$0 1 funcref))
+
+;; CHECK: (export "mem" (memory $0))
+
+;; CHECK: (export "tab" (table $timport$0))
(module ;; and not when there are segments
;; CHECK: (type $0 (func))
;; CHECK: (import "env" "memory" (memory $0 256))
(import "env" "memory" (memory $0 256))
- ;; CHECK: (import "env" "table" (table $timport$0 1 funcref))
(import "env" "table" (table 1 funcref))
(data (i32.const 1) "hello, world!")
(elem (i32.const 0) $waka)
+ ;; CHECK: (import "env" "table" (table $timport$0 1 funcref))
+
;; CHECK: (data $0 (i32.const 1) "hello, world!")
;; CHECK: (elem $0 (i32.const 0) $waka)
@@ -233,10 +236,12 @@
(type $0 (func))
;; CHECK: (import "env" "memory" (memory $0 256))
(import "env" "memory" (memory $0 256))
- ;; CHECK: (import "env" "table" (table $timport$0 0 funcref))
(import "env" "table" (table 0 funcref))
- ;; CHECK: (export "user" (func $user))
(export "user" $user)
+ ;; CHECK: (import "env" "table" (table $timport$0 0 funcref))
+
+ ;; CHECK: (export "user" (func $user))
+
;; CHECK: (func $user (type $0)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i32.load
@@ -257,8 +262,9 @@
;; CHECK: (memory $0 (shared 23 256))
(memory $0 (shared 23 256))
- ;; CHECK: (export "user" (func $user))
(export "user" $user)
+ ;; CHECK: (export "user" (func $user))
+
;; CHECK: (func $user (type $0)
;; CHECK-NEXT: (i32.store
;; CHECK-NEXT: (i32.const 0)
@@ -274,8 +280,9 @@
;; CHECK: (memory $0 (shared 23 256))
(memory $0 (shared 23 256))
- ;; CHECK: (export "user" (func $user))
(export "user" $user)
+ ;; CHECK: (export "user" (func $user))
+
;; CHECK: (func $user (type $0) (result i32)
;; CHECK-NEXT: (i32.atomic.rmw.add
;; CHECK-NEXT: (i32.const 0)
@@ -291,8 +298,9 @@
;; CHECK: (memory $0 (shared 23 256))
(memory $0 (shared 23 256))
- ;; CHECK: (export "user" (func $user))
(export "user" $user)
+ ;; CHECK: (export "user" (func $user))
+
;; CHECK: (func $user (type $0) (result i32)
;; CHECK-NEXT: (i32.atomic.rmw8.cmpxchg_u
;; CHECK-NEXT: (i32.const 0)
@@ -309,8 +317,9 @@
;; CHECK: (memory $0 (shared 23 256))
(memory $0 (shared 23 256))
- ;; CHECK: (export "user" (func $user))
(export "user" $user)
+ ;; CHECK: (export "user" (func $user))
+
;; CHECK: (func $user (type $0)
;; CHECK-NEXT: (local $0 i32)
;; CHECK-NEXT: (local $1 i64)
@@ -339,8 +348,9 @@
;; CHECK: (memory $0 (shared 23 256))
(memory $0 (shared 23 256))
- ;; CHECK: (export "user" (func $user))
(export "user" $user)
+ ;; CHECK: (export "user" (func $user))
+
;; CHECK: (func $user (type $0) (result i32)
;; CHECK-NEXT: (memory.atomic.notify
;; CHECK-NEXT: (i32.const 0)
@@ -354,12 +364,13 @@
(module ;; atomic.fence and data.drop do not use a memory, so should not keep the memory alive.
(memory $0 (shared 1 1))
(data "")
+ (export "fake-user" $user)
;; CHECK: (type $0 (func))
;; CHECK: (data $0 "")
;; CHECK: (export "fake-user" (func $user))
- (export "fake-user" $user)
+
;; CHECK: (func $user (type $0)
;; CHECK-NEXT: (atomic.fence)
;; CHECK-NEXT: (data.drop $0)
@@ -378,8 +389,9 @@
(memory $1 23 256)
(memory $unused 1 1)
- ;; CHECK: (export "user" (func $user))
(export "user" $user)
+ ;; CHECK: (export "user" (func $user))
+
;; CHECK: (func $user (type $0)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (memory.grow $0
@@ -402,8 +414,9 @@
;; CHECK: (memory $0 23 256)
(memory $0 23 256)
- ;; CHECK: (export "user" (func $user))
(export "user" $user)
+ ;; CHECK: (export "user" (func $user))
+
;; CHECK: (func $user (type $0) (result i32)
;; CHECK-NEXT: (memory.size)
;; CHECK-NEXT: )
@@ -419,8 +432,9 @@
;; CHECK: (memory $1 1 1)
(memory $1 1 1)
(memory $unused 1 1)
- ;; CHECK: (export "user" (func $user))
(export "user" $user)
+ ;; CHECK: (export "user" (func $user))
+
;; CHECK: (func $user (type $0)
;; CHECK-NEXT: (memory.copy $0 $1
;; CHECK-NEXT: (i32.const 0)
@@ -441,8 +455,9 @@
;; CHECK: (import "env" "memory" (memory $0 256))
(import "env" "memory" (memory $0 256))
- ;; CHECK: (import "env" "table" (table $timport$0 0 funcref))
(import "env" "table" (table 0 funcref))
+ ;; CHECK: (import "env" "table" (table $timport$0 0 funcref))
+
;; CHECK: (import "env" "memoryBase" (global $memoryBase i32))
(import "env" "memoryBase" (global $memoryBase i32)) ;; used in init
;; CHECK: (import "env" "tableBase" (global $tableBase i32))
@@ -467,8 +482,8 @@
;; CHECK: (import "env" "imported" (global $imported i32))
(import "env" "imported" (global $imported i32))
- ;; CHECK: (import "env" "_puts" (func $_puts (type $2) (param i32) (result i32)))
(import "env" "forgetme" (global $forgetme i32))
+ ;; CHECK: (import "env" "_puts" (func $_puts (type $2) (param i32) (result i32)))
(import "env" "_puts" (func $_puts (param i32) (result i32)))
(import "env" "forget_puts" (func $forget_puts (param i32) (result i32)))
;; CHECK: (global $int (mut i32) (global.get $imported))
diff --git a/test/lit/wasm-split/jspi-secondary-export.wast b/test/lit/wasm-split/jspi-secondary-export.wast
index 6bb388fec..57fe849a9 100644
--- a/test/lit/wasm-split/jspi-secondary-export.wast
+++ b/test/lit/wasm-split/jspi-secondary-export.wast
@@ -8,27 +8,6 @@
;; enabled.
(module
- ;; PRIMARY: (type $0 (func (param i32) (result i32)))
-
- ;; PRIMARY: (type $3 (func (param externref)))
-
- ;; PRIMARY: (type $1 (func (param externref i32) (result i32)))
-
- ;; PRIMARY: (type $2 (func))
-
- ;; PRIMARY: (import "env" "__load_secondary_module" (func $import$__load_secondary_module (param externref)))
-
- ;; PRIMARY: (import "placeholder" "0" (func $placeholder_0 (param i32) (result i32)))
-
- ;; PRIMARY: (global $suspender (mut externref) (ref.null noextern))
-
- ;; PRIMARY: (global $global$1 (mut i32) (i32.const 0))
-
- ;; PRIMARY: (table $0 1 funcref)
-
- ;; PRIMARY: (elem $0 (i32.const 0) $placeholder_0)
-
- ;; PRIMARY: (export "foo" (func $export$foo))
(export "foo" (func $foo))
;; SECONDARY: (type $0 (func (param i32) (result i32)))
@@ -47,6 +26,28 @@
(i32.const 0)
)
)
+;; PRIMARY: (type $0 (func (param i32) (result i32)))
+
+;; PRIMARY: (type $3 (func (param externref)))
+
+;; PRIMARY: (type $1 (func (param externref i32) (result i32)))
+
+;; PRIMARY: (type $2 (func))
+
+;; PRIMARY: (import "env" "__load_secondary_module" (func $import$__load_secondary_module (param externref)))
+
+;; PRIMARY: (import "placeholder" "0" (func $placeholder_0 (param i32) (result i32)))
+
+;; PRIMARY: (global $suspender (mut externref) (ref.null noextern))
+
+;; PRIMARY: (global $global$1 (mut i32) (i32.const 0))
+
+;; PRIMARY: (table $0 1 funcref)
+
+;; PRIMARY: (elem $0 (i32.const 0) $placeholder_0)
+
+;; PRIMARY: (export "foo" (func $export$foo))
+
;; PRIMARY: (export "load_secondary_module_status" (global $global$1))
;; PRIMARY: (export "%table" (table $0))
diff --git a/test/lit/wasm-split/jspi.wast b/test/lit/wasm-split/jspi.wast
index b1f1b56f3..340b2acec 100644
--- a/test/lit/wasm-split/jspi.wast
+++ b/test/lit/wasm-split/jspi.wast
@@ -29,11 +29,11 @@
;; PRIMARY: (elem $0 (i32.const 0) $placeholder_0)
;; PRIMARY: (export "foo" (func $export$foo))
- (export "foo" (func $foo))
+
;; PRIMARY: (export "load_secondary_module_status" (global $global$1))
;; PRIMARY: (export "%foo" (func $foo))
-
+ (export "foo" (func $foo))
;; PRIMARY: (export "%table" (table $0))
;; PRIMARY: (export "%global" (global $suspender))
diff --git a/test/lit/wasm-split/multi-memory-lowering-export.wast b/test/lit/wasm-split/multi-memory-lowering-export.wast
index 156ac2efe..0721ba2a4 100644
--- a/test/lit/wasm-split/multi-memory-lowering-export.wast
+++ b/test/lit/wasm-split/multi-memory-lowering-export.wast
@@ -5,17 +5,18 @@
(module
(memory $memory1 1)
(memory $memory2 1 1)
- ;; CHECK: (type $0 (func (result i32)))
+ (export "mem" (memory $memory1))
+)
- ;; CHECK: (type $1 (func (param i32) (result i32)))
+;; CHECK: (type $0 (func (result i32)))
- ;; CHECK: (global $memory2_byte_offset (mut i32) (i32.const 65536))
+;; CHECK: (type $1 (func (param i32) (result i32)))
- ;; CHECK: (memory $combined_memory 1 1)
+;; CHECK: (global $memory2_byte_offset (mut i32) (i32.const 65536))
- ;; CHECK: (export "mem" (memory $combined_memory))
- (export "mem" (memory $memory1))
-)
+;; CHECK: (memory $combined_memory 1 1)
+
+;; CHECK: (export "mem" (memory $combined_memory))
;; CHECK: (func $memory1_size (type $0) (result i32)
;; CHECK-NEXT: (return
diff --git a/test/lit/wasm-split/multi-memory-lowering-import.wast b/test/lit/wasm-split/multi-memory-lowering-import.wast
index e00c13799..d62609108 100644
--- a/test/lit/wasm-split/multi-memory-lowering-import.wast
+++ b/test/lit/wasm-split/multi-memory-lowering-import.wast
@@ -3,15 +3,16 @@
;; RUN: wasm-opt %s --multi-memory-lowering -all -S -o - | filecheck %s
(module
- ;; CHECK: (type $0 (func (result i32)))
-
- ;; CHECK: (type $1 (func (param i32) (result i32)))
-
- ;; CHECK: (import "env" "mem" (memory $combined_memory 2 2))
(import "env" "mem" (memory $memory1 1 1))
(memory $memory2 1 1)
)
+;; CHECK: (type $0 (func (result i32)))
+
+;; CHECK: (type $1 (func (param i32) (result i32)))
+
+;; CHECK: (import "env" "mem" (memory $combined_memory 2 2))
+
;; CHECK: (global $memory2_byte_offset (mut i32) (i32.const 65536))
;; CHECK: (func $memory1_size (type $0) (result i32)
diff --git a/test/lit/wat-kitchen-sink.wast b/test/lit/wat-kitchen-sink.wast
index af2fbffc5..a45ef7e9c 100644
--- a/test/lit/wat-kitchen-sink.wast
+++ b/test/lit/wat-kitchen-sink.wast
@@ -354,6 +354,7 @@
(tag $tag-pair (param i32 i64))
;; explicit exports
+ (export "exported-func" (func 0))
;; CHECK: (export "g1" (global $g1))
;; CHECK: (export "g1.1" (global $g1))
@@ -375,19 +376,21 @@
;; CHECK: (export "t0.1" (tag $imported))
;; CHECK: (export "exported-func" (func $fimport$0))
- (export "exported-func" (func 0))
- ;; CHECK: (export "exported-table" (table $timport$0))
- (export "exported-table" (table 0))
- ;; CHECK: (export "exported-memory" (memory $mimport$0))
+
+ ;; CHECK: (export "exported-table" (table $funcs))
+ (export "exported-table" (table $funcs))
(export "exported-memory" (memory 0))
+ ;; CHECK: (export "exported-memory" (memory $mimport$0))
+
;; CHECK: (export "exported-global" (global $g1))
- (export "exported-global" (global 0))
- ;; CHECK: (export "exported-tag" (tag $imported))
+ (export "exported-global" (global $g1))
(export "exported-tag" (tag 0))
;; functions
(func)
+ ;; CHECK: (export "exported-tag" (tag $imported))
+
;; CHECK: (func $1 (type $void)
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )