summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2021-06-28 22:02:17 +0000
committerGitHub <noreply@github.com>2021-06-28 15:02:17 -0700
commit6a2d7f989065820476268a2382db2eccf72aadd7 (patch)
treec83ca0e6057629a43158acd32d942c329485717e
parent395b071ae9b09f0b4fe3ce0f3a43f16ba74f01a5 (diff)
downloadbinaryen-6a2d7f989065820476268a2382db2eccf72aadd7.tar.gz
binaryen-6a2d7f989065820476268a2382db2eccf72aadd7.tar.bz2
binaryen-6a2d7f989065820476268a2382db2eccf72aadd7.zip
Generate FileCheck checks for all module items (#3957)
Instead of only generating checks for functions, generate checks for all named top-level module items, such as types, tags, tables, and memories. Because module items can be in different orders in the input and the output but FileCheck checks must follow the order of the output, we need to be slightly clever about when we emit the checks. Consider these types in the input file: ``` (type $A (...)) (type $B (...)) ``` If their order is reversed in the output file, then the checks for $B need to be emitted before the checks for $A, so the resulting module will look like this: ``` ;; CHECK: (type $B (...)) ;; CHECK: (type $A (...)) (type $A (...)) (type $B (...)) ``` Rather than this, which looks nicer but would be incorrect: ``` ;; CHECK: (type $A (...)) (type $A (...)) ;; CHECK: (type $B (...)) (type $B (...)) ```
-rwxr-xr-xscripts/update_lit_checks.py109
-rw-r--r--test/lit/forward-declared-types.wast9
-rw-r--r--test/lit/gc-read-write-effects.wast1
-rw-r--r--test/lit/lub-bug-3843.wast4
-rw-r--r--test/lit/nominal-chain.wast19
-rw-r--r--test/lit/nominal-func.wast3
-rw-r--r--test/lit/nominal-good.wast4
-rw-r--r--test/lit/passes/coalesce-locals-eh.wast1
-rw-r--r--test/lit/passes/coalesce-locals-gc.wast2
-rw-r--r--test/lit/passes/code-folding-eh.wast5
-rw-r--r--test/lit/passes/code-pushing-eh.wast5
-rw-r--r--test/lit/passes/dae-gc.wast1
-rw-r--r--test/lit/passes/dce-eh.wast5
-rw-r--r--test/lit/passes/flatten.wast1
-rw-r--r--test/lit/passes/heap2local.wast5
-rw-r--r--test/lit/passes/inlining-eh.wast2
-rw-r--r--test/lit/passes/inlining-optimizing.wast2
-rw-r--r--test/lit/passes/instrument-locals-eh.wast1
-rw-r--r--test/lit/passes/opt_flatten.wast1
-rw-r--r--test/lit/passes/optimize-instructions-atomics.wast1
-rw-r--r--test/lit/passes/optimize-instructions-eh.wast5
-rw-r--r--test/lit/passes/optimize-instructions-gc-iit.wast7
-rw-r--r--test/lit/passes/optimize-instructions-gc.wast7
-rw-r--r--test/lit/passes/optimize-instructions-ignore-traps.wast2
-rw-r--r--test/lit/passes/optimize-instructions-typed-function-references.wast1
-rw-r--r--test/lit/passes/optimize-instructions.wast1
-rw-r--r--test/lit/passes/poppify.wast1
-rw-r--r--test/lit/passes/precompute-gc.wast5
-rw-r--r--test/lit/passes/remove-unused-brs.wast6
-rw-r--r--test/lit/passes/remove-unused-names-eh.wast1
-rw-r--r--test/lit/passes/roundtrip-gc-types.wast19
-rw-r--r--test/lit/passes/roundtrip.wast1
-rw-r--r--test/lit/passes/rse-eh.wast6
-rw-r--r--test/lit/passes/simplify-locals-eh.wast1
-rw-r--r--test/lit/passes/simplify-locals-gc.wast1
-rw-r--r--test/lit/passes/ssa.wast4
-rw-r--r--test/lit/passes/stack-ir-eh.wast8
-rw-r--r--test/lit/passes/vacuum-eh.wast2
38 files changed, 202 insertions, 57 deletions
diff --git a/scripts/update_lit_checks.py b/scripts/update_lit_checks.py
index d8446288a..bd3fbe208 100755
--- a/scripts/update_lit_checks.py
+++ b/scripts/update_lit_checks.py
@@ -31,9 +31,15 @@ import tempfile
script_name = os.path.basename(__file__)
NOTICE = (f';; NOTE: Assertions have been generated by {script_name} and ' +
'should not be edited.')
+
+
RUN_LINE_RE = re.compile(r'^\s*;;\s*RUN:\s*(.*)$')
CHECK_PREFIX_RE = re.compile(r'.*--check-prefix[= ](\S+).*')
-FUNC_RE = re.compile(r'(^\s*)\(func \$(\S*).*$', re.MULTILINE)
+
+items = ['type', 'import', 'global', 'memory', 'data', 'table', 'elem', 'tag',
+ 'export', 'start', 'func']
+ITEM_RE = re.compile(r'(^\s*)\((' + '|'.join(items) + r')\s+(\$?[^\s()]*).*$',
+ re.MULTILINE)
def warn(msg):
@@ -83,21 +89,30 @@ def run_command(args, test, tmp, command):
return subprocess.check_output(command, shell=True, env=env).decode('utf-8')
-def find_funcs(module):
- """Return a dict mapping each function name to lines in the function"""
- result = {}
- for match in FUNC_RE.finditer(module):
- name = match.group(2)
- depth = 1
- for end in range(match.end(), len(module)):
- if depth == 0:
- break
- elif module[end] == '(':
- depth += 1
- elif module[end] == ')':
- depth -= 1
- result[name] = module[match.start():end].split('\n')
- return result
+def find_end(module, start):
+ # Find the index one past the closing parenthesis corresponding to the first
+ # open parenthesis at `start`.
+ assert module[start] == '('
+ depth = 1
+ for end in range(start + 1, len(module)):
+ if depth == 0:
+ break
+ elif module[end] == '(':
+ depth += 1
+ elif module[end] == ')':
+ depth -= 1
+ return end
+
+
+def split_output(module):
+ # Return a list of (name, [lines]) for module items
+ out = []
+ for match in ITEM_RE.finditer(module):
+ kind, name = match[2], match[3]
+ end = find_end(module, match.end(1))
+ lines = module[match.start():end].split('\n')
+ out.append(((kind, name), lines))
+ return out
def main():
@@ -122,6 +137,7 @@ def main():
tmp = tempfile.mktemp()
for test, lines in itertests(args):
+ # List of (prefix, command)
run_list = []
for line in find_run_lines(test, lines):
commands = [cmd.strip() for cmd in line.rsplit('|', 1)]
@@ -140,32 +156,63 @@ def main():
run_list.append((check_prefix, commands[0]))
- # Map check prefixes and function names to the corresponding output
- func_dict = {}
+ # Map check prefixes to lists of ((kind, name), [lines])
+ output_modules = {}
for prefix, command, in run_list:
output = run_command(args, test, tmp, command)
if prefix:
- func_dict[prefix] = find_funcs(output)
+ output_modules[prefix] = split_output(output)
- check_line_re = re.compile(r'^\s*;;\s*(' + '|'.join(func_dict.keys()) +
- r')(?:-NEXT|-LABEL|-NOT)?: .*$')
+ any_prefix = '|'.join(output_modules.keys())
+ check_line_re = re.compile(r'^\s*;;\s*(' + any_prefix +
+ r')(?:-NEXT|-LABEL|-NOT)?:.*$')
output_lines = [NOTICE]
+
+ def emit_checks(indent, prefix, lines):
+ output_lines.append(f'{indent};; {prefix}: {lines[0]}')
+ for line in lines[1:]:
+ output_lines.append(f'{indent};; {prefix}-NEXT:{line}')
+
+ # Skip the notice if it is already in the output
if lines and script_name in lines[0]:
lines = lines[1:]
+
+ named_items = []
+ for line in lines:
+ match = ITEM_RE.match(line)
+ if match:
+ kind, name = match[2], match[3]
+ named_items.append((kind, name))
+
for line in lines:
+ # Skip pre-existing check lines; we will regenerate them.
if check_line_re.match(line):
continue
- func_match = FUNC_RE.match(line)
- if func_match:
- indent, name = func_match.groups()
- for prefix, funcs in func_dict.items():
- body = funcs.get(name, [])
- if not body:
- continue
- output_lines.append(f'{indent};; {prefix}: {body[0]}')
- for l in body[1:]:
- output_lines.append(f'{indent};; {prefix}-NEXT:{l}')
+ match = ITEM_RE.match(line)
+ if match:
+ indent, kind, name = match.groups()
+ for prefix, items in output_modules.items():
+ # If the output for this prefix contains an item with this
+ # name, emit all the items up to and including the matching
+ # item
+ has_item = False
+ for kind_name, lines in items:
+ if name and (kind, name) == kind_name:
+ has_item = True
+ break
+ if has_item:
+ while True:
+ kind_name, lines = items.pop(0)
+ if kind_name in named_items:
+ emit_checks(indent, prefix, lines)
+ if name and (kind, name) == kind_name:
+ break
output_lines.append(line)
+ # Output any remaining checks for each prefix
+ for prefix, items in output_modules.items():
+ for kind_name, lines in items:
+ if kind_name in named_items:
+ emit_checks('', prefix, lines)
if args.dry_run:
print('\n'.join(output_lines))
diff --git a/test/lit/forward-declared-types.wast b/test/lit/forward-declared-types.wast
index dc1407049..876ebefd8 100644
--- a/test/lit/forward-declared-types.wast
+++ b/test/lit/forward-declared-types.wast
@@ -1,17 +1,16 @@
+;; 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
-;; CHECK: (type $func (func))
-;; CHECK: (type $none_=>_ref?|$struct| (func (result (ref null $struct))))
-;; CHECK: (type $struct (struct (field (ref $array)) (field (ref null $func))))
-;; CHECK: (type $array (array (rtt 2 $func)))
-
(module
+ ;; CHECK: (type $func (func))
+ ;; CHECK: (type $struct (struct (field (ref $array)) (field (ref null $func))))
(type $struct (struct
(field (ref $array))
(field (ref null $func))
))
+ ;; CHECK: (type $array (array (rtt 2 $func)))
(type $array (array (field (rtt 2 $func))))
(type $func (func))
diff --git a/test/lit/gc-read-write-effects.wast b/test/lit/gc-read-write-effects.wast
index f487a92f5..6ebdd9b06 100644
--- a/test/lit/gc-read-write-effects.wast
+++ b/test/lit/gc-read-write-effects.wast
@@ -6,6 +6,7 @@
;; RUN: wasm-opt -all --simplify-locals %s -S -o - | filecheck %s
(module
+ ;; CHECK: (type $A (struct (field (mut i32))))
(type $A (struct
(field (mut i32))
))
diff --git a/test/lit/lub-bug-3843.wast b/test/lit/lub-bug-3843.wast
index 849134d7a..37206edc7 100644
--- a/test/lit/lub-bug-3843.wast
+++ b/test/lit/lub-bug-3843.wast
@@ -6,8 +6,12 @@
;; returning (ref null $A).
(module
+ ;; CHECK: (type $A (struct (field (ref null $C))))
(type $A (struct (field (ref null $C))))
+ ;; CHECK: (type $B (struct (field (ref null $D))))
(type $B (struct (field (ref null $D))))
+ ;; CHECK: (type $D (struct (field (mut (ref $A))) (field (mut (ref $A)))))
+ ;; CHECK: (type $C (struct (field (mut (ref $A)))))
(type $C (struct (field (mut (ref $A)))))
(type $D (struct (field (mut (ref $A))) (field (mut (ref $A)))))
diff --git a/test/lit/nominal-chain.wast b/test/lit/nominal-chain.wast
index b6b48a191..5c5807a15 100644
--- a/test/lit/nominal-chain.wast
+++ b/test/lit/nominal-chain.wast
@@ -1,3 +1,4 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
;; RUN: wasm-opt %s -all --nominal -S -o - | filecheck %s
;; RUN: wasm-opt %s -all --nominal --roundtrip -S -o - | filecheck %s
@@ -6,20 +7,24 @@
;; types.
(module
-
;; CHECK: (type $root (struct ))
- ;; CHECK-NEXT: (type $none_=>_ref?|$root| (func (result (ref null $root))))
- ;; CHECK-NEXT: (type $leaf (struct (field i32) (field i64) (field f32) (field f64)) (extends $twig))
- ;; CHECK-NEXT: (type $twig (struct (field i32) (field i64) (field f32)) (extends $branch))
- ;; CHECK-NEXT: (type $branch (struct (field i32) (field i64)) (extends $trunk))
- ;; CHECK-NEXT: (type $trunk (struct (field i32)) (extends $root))
-
+ ;; CHECK: (type $leaf (struct (field i32) (field i64) (field f32) (field f64)) (extends $twig))
(type $leaf (struct i32 i64 f32 f64) (extends $twig))
+
+ ;; CHECK: (type $twig (struct (field i32) (field i64) (field f32)) (extends $branch))
(type $twig (struct i32 i64 f32) (extends $branch))
+
+ ;; CHECK: (type $branch (struct (field i32) (field i64)) (extends $trunk))
(type $branch (struct i32 i64) (extends $trunk))
+
+ ;; CHECK: (type $trunk (struct (field i32)) (extends $root))
(type $trunk (struct i32) (extends $root))
+
(type $root (struct))
+ ;; CHECK: (func $make-root (result (ref null $root))
+ ;; CHECK-NEXT: (ref.null $leaf)
+ ;; CHECK-NEXT: )
(func $make-root (result (ref null $root))
(ref.null $leaf)
)
diff --git a/test/lit/nominal-func.wast b/test/lit/nominal-func.wast
index b4f0a2f15..4aeef2eb7 100644
--- a/test/lit/nominal-func.wast
+++ b/test/lit/nominal-func.wast
@@ -6,10 +6,11 @@
(module
;; This will be the "canonical" function type rather than $foo_t
+ ;; CHECK: (type $bad_t (func))
(type $bad_t (func))
+ ;; CHECK: (type $foo_t (func))
(type $foo_t (func))
- (type $struct (struct (ref $foo_t)))
;; CHECK: (func $foo
;; CHECK-NEXT: (unreachable)
diff --git a/test/lit/nominal-good.wast b/test/lit/nominal-good.wast
index d63b0506a..8fff43d6a 100644
--- a/test/lit/nominal-good.wast
+++ b/test/lit/nominal-good.wast
@@ -4,9 +4,13 @@
(module
+ ;; CHECK: (type $super-struct (struct (field i32)))
+ ;; CHECK: (type $sub-struct (struct (field i32) (field i64)) (extends $super-struct))
(type $sub-struct (struct i32 i64) (extends $super-struct))
(type $super-struct (struct i32))
+ ;; CHECK: (type $super-array (array (ref $super-struct)))
+ ;; CHECK: (type $sub-array (array (ref $sub-struct)) (extends $super-array))
(type $sub-array (array (ref $sub-struct)) (extends $super-array))
(type $super-array (array (ref $super-struct)))
diff --git a/test/lit/passes/coalesce-locals-eh.wast b/test/lit/passes/coalesce-locals-eh.wast
index d2d7136fc..20c1d3152 100644
--- a/test/lit/passes/coalesce-locals-eh.wast
+++ b/test/lit/passes/coalesce-locals-eh.wast
@@ -2,6 +2,7 @@
;; RUN: wasm-opt %s --coalesce-locals -all -S -o - | filecheck %s
(module
+ ;; CHECK: (tag $e (param))
;; CHECK: (func $bar (result i32)
;; CHECK-NEXT: (i32.const 1984)
;; CHECK-NEXT: )
diff --git a/test/lit/passes/coalesce-locals-gc.wast b/test/lit/passes/coalesce-locals-gc.wast
index 173ad02be..2c0fc3f03 100644
--- a/test/lit/passes/coalesce-locals-gc.wast
+++ b/test/lit/passes/coalesce-locals-gc.wast
@@ -3,7 +3,9 @@
;; RUN: | filecheck %s
(module
+ ;; CHECK: (type $array (array (mut i8)))
(type $array (array (mut i8)))
+ ;; CHECK: (global $global (ref null $array) (ref.null $array))
(global $global (ref null $array) (ref.null $array))
;; CHECK: (func $test-dead-get-non-nullable (param $0 dataref)
diff --git a/test/lit/passes/code-folding-eh.wast b/test/lit/passes/code-folding-eh.wast
index 9ca8f1ea7..11d518475 100644
--- a/test/lit/passes/code-folding-eh.wast
+++ b/test/lit/passes/code-folding-eh.wast
@@ -3,6 +3,7 @@
;; RUN: | filecheck %s
(module
+ ;; CHECK: (tag $e-i32 (param i32))
(tag $e-i32 (param i32))
;; CHECK: (func $pop-test
@@ -66,7 +67,11 @@
)
)
+ ;; CHECK: (func $foo
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
(func $foo)
+
;; CHECK: (func $try-call-optimize-terminating-tails (result i32)
;; CHECK-NEXT: (try
;; CHECK-NEXT: (do
diff --git a/test/lit/passes/code-pushing-eh.wast b/test/lit/passes/code-pushing-eh.wast
index f45ef5c3f..a18b10dae 100644
--- a/test/lit/passes/code-pushing-eh.wast
+++ b/test/lit/passes/code-pushing-eh.wast
@@ -2,6 +2,7 @@
;; RUN: wasm-opt %s --code-pushing -all -S -o - | filecheck %s
(module
+ ;; CHECK: (tag $e (param i32))
(tag $e (param i32))
;; CHECK: (func $cant-push-past-call
@@ -111,7 +112,11 @@
)
)
+ ;; CHECK: (func $foo
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
(func $foo)
+
;; CHECK: (func $cant-push-past-try
;; CHECK-NEXT: (local $x i32)
;; CHECK-NEXT: (block $out
diff --git a/test/lit/passes/dae-gc.wast b/test/lit/passes/dae-gc.wast
index fe4b346ea..65d65d4c9 100644
--- a/test/lit/passes/dae-gc.wast
+++ b/test/lit/passes/dae-gc.wast
@@ -2,6 +2,7 @@
;; RUN: wasm-opt %s -all --dae -S -o - | filecheck %s
(module
+ ;; CHECK: (type ${} (struct ))
(type ${} (struct))
;; CHECK: (func $foo
diff --git a/test/lit/passes/dce-eh.wast b/test/lit/passes/dce-eh.wast
index af216765c..e2268f87b 100644
--- a/test/lit/passes/dce-eh.wast
+++ b/test/lit/passes/dce-eh.wast
@@ -4,9 +4,14 @@
;; If either try body or catch body is reachable, the whole try construct is
;; reachable
(module
+ ;; CHECK: (tag $e (param))
+ ;; CHECK: (func $foo
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
(func $foo)
(tag $e)
+
;; CHECK: (func $try_unreachable
;; CHECK-NEXT: (try $try
;; CHECK-NEXT: (do
diff --git a/test/lit/passes/flatten.wast b/test/lit/passes/flatten.wast
index f734996a5..e07c8fafb 100644
--- a/test/lit/passes/flatten.wast
+++ b/test/lit/passes/flatten.wast
@@ -2,6 +2,7 @@
;; RUN: wasm-opt %s -all --flatten -S -o - | filecheck %s
(module
+ ;; CHECK: (type $simplefunc (func))
(type $simplefunc (func))
;; CHECK: (func $0 (param $0 (ref $simplefunc)) (result (ref $simplefunc))
;; CHECK-NEXT: (local $1 (ref null $simplefunc))
diff --git a/test/lit/passes/heap2local.wast b/test/lit/passes/heap2local.wast
index 9f0807b3b..efca63028 100644
--- a/test/lit/passes/heap2local.wast
+++ b/test/lit/passes/heap2local.wast
@@ -3,10 +3,15 @@
;; RUN: wasm-opt %s -all --remove-unused-names --heap2local -S -o - | filecheck %s
(module
+ ;; CHECK: (type $struct.A (struct (field (mut i32)) (field (mut f64))))
(type $struct.A (struct (field (mut i32)) (field (mut f64))))
+ ;; CHECK: (type $struct.recursive (struct (field (mut (ref null $struct.recursive)))))
+ ;; CHECK: (type $struct.nonnullable (struct (field (ref $struct.A))))
+ ;; CHECK: (type $struct.packed (struct (field (mut i8))))
(type $struct.packed (struct (field (mut i8))))
+ ;; CHECK: (type $struct.nondefaultable (struct (field (rtt $struct.A))))
(type $struct.nondefaultable (struct (field (rtt $struct.A))))
(type $struct.recursive (struct (field (mut (ref null $struct.recursive)))))
diff --git a/test/lit/passes/inlining-eh.wast b/test/lit/passes/inlining-eh.wast
index e2b512410..5ec3c55dc 100644
--- a/test/lit/passes/inlining-eh.wast
+++ b/test/lit/passes/inlining-eh.wast
@@ -3,7 +3,9 @@
(module
;; ---------------------------------------------------------------------------
+ ;; CHECK: (import "a" "b" (func $foo (result i32)))
(import "a" "b" (func $foo (result i32)))
+ ;; CHECK: (tag $tag$0 (param i32))
(tag $tag$0 (param i32))
(func $callee-with-label
(try $label
diff --git a/test/lit/passes/inlining-optimizing.wast b/test/lit/passes/inlining-optimizing.wast
index bbbb385f8..31e9aaa7a 100644
--- a/test/lit/passes/inlining-optimizing.wast
+++ b/test/lit/passes/inlining-optimizing.wast
@@ -2,7 +2,9 @@
;; RUN: wasm-opt %s -all --inlining-optimizing -S -o - | filecheck %s
(module
+ ;; CHECK: (type $none_=>_none (func))
(type $none_=>_none (func))
+ ;; CHECK: (type $none_=>_i32 (func (result i32)))
(type $none_=>_i32 (func (result i32)))
;; CHECK: (func $0
;; CHECK-NEXT: (nop)
diff --git a/test/lit/passes/instrument-locals-eh.wast b/test/lit/passes/instrument-locals-eh.wast
index a55a05416..44535b7c2 100644
--- a/test/lit/passes/instrument-locals-eh.wast
+++ b/test/lit/passes/instrument-locals-eh.wast
@@ -2,6 +2,7 @@
;; RUN: wasm-opt %s --instrument-locals -all -S -o - | filecheck %s
(module
+ ;; CHECK: (tag $e (param i32))
(tag $e (param i32))
;; CHECK: (func $test
diff --git a/test/lit/passes/opt_flatten.wast b/test/lit/passes/opt_flatten.wast
index e3cf103f3..048ccd60d 100644
--- a/test/lit/passes/opt_flatten.wast
+++ b/test/lit/passes/opt_flatten.wast
@@ -5,6 +5,7 @@
;; RUN: wasm-opt %s -all -O1 --flatten --rereloop -S -o - | filecheck %s
(module
+ ;; CHECK: (export "foo" (func $foo))
(export "foo" (func $foo))
;; CHECK: (func $foo (result funcref)
;; CHECK-NEXT: (local $0 funcref)
diff --git a/test/lit/passes/optimize-instructions-atomics.wast b/test/lit/passes/optimize-instructions-atomics.wast
index 83ad545ba..d029942fe 100644
--- a/test/lit/passes/optimize-instructions-atomics.wast
+++ b/test/lit/passes/optimize-instructions-atomics.wast
@@ -2,6 +2,7 @@
;; RUN: wasm-opt %s --optimize-instructions --enable-threads -S -o - | filecheck %s
(module
+ ;; CHECK: (import "env" "memory" (memory $0 (shared 256 256)))
(import "env" "memory" (memory $0 (shared 256 256)))
;; CHECK: (func $x
diff --git a/test/lit/passes/optimize-instructions-eh.wast b/test/lit/passes/optimize-instructions-eh.wast
index 2c7f83aee..92a2dd37c 100644
--- a/test/lit/passes/optimize-instructions-eh.wast
+++ b/test/lit/passes/optimize-instructions-eh.wast
@@ -3,6 +3,10 @@
;; RUN: | filecheck %s
(module
+ ;; CHECK: (tag $e (param i32))
+ ;; CHECK: (func $dummy
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
(func $dummy)
(tag $e (param i32))
@@ -17,6 +21,7 @@
;; (i32.add (local.get $x) (i32.const 7)) can be just (local.get $x) when $x
;; is guaranteed to contain a value equal to or less than 7.
+
;; CHECK: (func $getFallthrough-try-no-throw
;; CHECK-NEXT: (local $x i32)
;; CHECK-NEXT: (local.set $x
diff --git a/test/lit/passes/optimize-instructions-gc-iit.wast b/test/lit/passes/optimize-instructions-gc-iit.wast
index 5409e14c4..c0d84ab1c 100644
--- a/test/lit/passes/optimize-instructions-gc-iit.wast
+++ b/test/lit/passes/optimize-instructions-gc-iit.wast
@@ -3,12 +3,19 @@
;; RUN: | filecheck %s
(module
+ ;; CHECK: (type $parent (struct (field i32)))
(type $parent (struct (field i32)))
+ ;; CHECK: (type $child (struct (field i32) (field f64)))
(type $child (struct (field i32) (field f64)))
+ ;; CHECK: (type $other (struct (field i64) (field f32)))
(type $other (struct (field i64) (field f32)))
+ ;; CHECK: (func $foo
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
(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-NEXT: (drop
;; CHECK-NEXT: (block (result (ref $parent))
diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast
index c0474a823..3f8c21bfc 100644
--- a/test/lit/passes/optimize-instructions-gc.wast
+++ b/test/lit/passes/optimize-instructions-gc.wast
@@ -3,6 +3,9 @@
;; RUN: | filecheck %s
(module
+ ;; CHECK: (type $struct (struct (field $i8 (mut i8)) (field $i16 (mut i16)) (field $i32 (mut i32)) (field $i64 (mut i64))))
+ ;; CHECK: (type $array (array (mut i8)))
+ ;; CHECK: (import "env" "get-i32" (func $get-i32 (result i32)))
(import "env" "get-i32" (func $get-i32 (result i32)))
(type $empty (struct))
@@ -612,8 +615,12 @@
)
)
+ ;; CHECK: (func $nothing
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
(func $nothing)
+
;; CHECK: (func $ref-eq-corner-cases (param $x eqref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.eq
diff --git a/test/lit/passes/optimize-instructions-ignore-traps.wast b/test/lit/passes/optimize-instructions-ignore-traps.wast
index 5c4784919..71baba86f 100644
--- a/test/lit/passes/optimize-instructions-ignore-traps.wast
+++ b/test/lit/passes/optimize-instructions-ignore-traps.wast
@@ -3,7 +3,9 @@
;; RUN: | filecheck %s
(module
+ ;; CHECK: (type $0 (func (param i32 i32) (result i32)))
(type $0 (func (param i32 i32) (result i32)))
+ ;; CHECK: (memory $0 0)
(memory $0 0)
;; CHECK: (func $conditionals (param $0 i32) (param $1 i32) (result i32)
;; CHECK-NEXT: (local $2 i32)
diff --git a/test/lit/passes/optimize-instructions-typed-function-references.wast b/test/lit/passes/optimize-instructions-typed-function-references.wast
index 812815c2d..418195b48 100644
--- a/test/lit/passes/optimize-instructions-typed-function-references.wast
+++ b/test/lit/passes/optimize-instructions-typed-function-references.wast
@@ -3,6 +3,7 @@
;; RUN: --enable-typed-function-references -S -o - | filecheck %s
(module
+ ;; CHECK: (type $i32-i32 (func (param i32) (result i32)))
(type $i32-i32 (func (param i32) (result i32)))
;; this function has a reference parameter. we analyze parameters, and should
;; not be confused by a type that has no bit size, in particular. this test
diff --git a/test/lit/passes/optimize-instructions.wast b/test/lit/passes/optimize-instructions.wast
index 5b5b44b57..728081e9f 100644
--- a/test/lit/passes/optimize-instructions.wast
+++ b/test/lit/passes/optimize-instructions.wast
@@ -3,6 +3,7 @@
(module
(memory 0)
+ ;; CHECK: (type $0 (func (param i32 i64)))
(type $0 (func (param i32 i64)))
;; CHECK: (func $and-and (param $i1 i32) (result i32)
;; CHECK-NEXT: (i32.and
diff --git a/test/lit/passes/poppify.wast b/test/lit/passes/poppify.wast
index 5becc6556..61de7e5c2 100644
--- a/test/lit/passes/poppify.wast
+++ b/test/lit/passes/poppify.wast
@@ -3,6 +3,7 @@
;; RUN: wasm-opt %s --poppify --no-validation -all -S -o - | filecheck %s
(module
+ ;; CHECK: (tag $e (param i32))
(tag $e (param i32))
;; CHECK: (func $id (param $x i32) (result i32)
diff --git a/test/lit/passes/precompute-gc.wast b/test/lit/passes/precompute-gc.wast
index cb6ba9bf0..b6c526e7b 100644
--- a/test/lit/passes/precompute-gc.wast
+++ b/test/lit/passes/precompute-gc.wast
@@ -3,7 +3,11 @@
;; RUN: | filecheck %s
(module
+ ;; CHECK: (type $struct (struct (field (mut i32))))
(type $struct (struct (mut i32)))
+ ;; CHECK: (type $B (struct (field (mut f64))))
+ ;; CHECK: (type $func-return-i32 (func (result i32)))
+ ;; CHECK: (type $empty (struct ))
(type $empty (struct))
;; two incompatible struct types
@@ -12,6 +16,7 @@
(type $func-return-i32 (func (result i32)))
+ ;; CHECK: (import "fuzzing-support" "log-i32" (func $log (param i32)))
(import "fuzzing-support" "log-i32" (func $log (param i32)))
;; CHECK: (func $test-fallthrough (result i32)
diff --git a/test/lit/passes/remove-unused-brs.wast b/test/lit/passes/remove-unused-brs.wast
index a43601654..089d82391 100644
--- a/test/lit/passes/remove-unused-brs.wast
+++ b/test/lit/passes/remove-unused-brs.wast
@@ -4,7 +4,9 @@
(module
+ ;; CHECK: (type $none_=>_i32 (func (result i32)))
(type $none_=>_i32 (func (result i32)))
+ ;; CHECK: (type $i32_=>_none (func (param i32)))
(type $i32_=>_none (func (param i32)))
;; Regression test in which we need to calculate a proper LUB.
@@ -54,8 +56,12 @@
)
)
+ ;; CHECK: (func $nothing
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
(func $nothing)
+
;; CHECK: (func $restructure-br_if-condition-reorderable (param $x i32) (result i32)
;; CHECK-NEXT: (if (result i32)
;; CHECK-NEXT: (block $block (result i32)
diff --git a/test/lit/passes/remove-unused-names-eh.wast b/test/lit/passes/remove-unused-names-eh.wast
index cf16dda0b..fcdbf0f07 100644
--- a/test/lit/passes/remove-unused-names-eh.wast
+++ b/test/lit/passes/remove-unused-names-eh.wast
@@ -2,6 +2,7 @@
;; RUN: wasm-opt %s --remove-unused-names -all -S -o - | filecheck %s
(module
+ ;; CHECK: (tag $tag$0 (param i32))
(tag $tag$0 (param i32))
;; CHECK: (func $func0
diff --git a/test/lit/passes/roundtrip-gc-types.wast b/test/lit/passes/roundtrip-gc-types.wast
index 5e7253352..85914fd79 100644
--- a/test/lit/passes/roundtrip-gc-types.wast
+++ b/test/lit/passes/roundtrip-gc-types.wast
@@ -1,26 +1,25 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
;; RUN: wasm-opt %s -all --roundtrip -S -o - | filecheck %s
;; Regression test for an issue in which roundtripping failed to reproduce the
;; original types because type canonicalization was incorrect when the canonical
;; types already existed in the store.
-;; CHECK: (module
-;; CHECK-NEXT: (type $A (struct (field (ref $C))))
-;; CHECK-NEXT: (type $C (struct (field (mut (ref $B)))))
-;; CHECK-NEXT: (type $B (func (param (ref $A)) (result (ref $B))))
-;; CHECK-NEXT: (type $D (struct (field (ref $C)) (field (ref $A))))
-;; CHECK-NEXT: (global $g0 (rtt 0 $A) (rtt.canon $A))
-;; CHECK-NEXT: (global $g1 (rtt 1 $D) (rtt.sub $D
-;; CHECK-NEXT: (global.get $g0)
-;; CHECK-NEXT: ))
-;; CHECK-NEXT: )
(module
+ ;; CHECK: (type $A (struct (field (ref $C))))
(type $A (struct (field (ref $C))))
+ ;; CHECK: (type $C (struct (field (mut (ref $B)))))
+ ;; CHECK: (type $B (func (param (ref $A)) (result (ref $B))))
(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))))
(type $D (struct (field (ref $C)) (field (ref $A))))
+ ;; CHECK: (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: ))
(global $g1 (rtt 1 $D) (rtt.sub $D
(global.get $g0)
))
diff --git a/test/lit/passes/roundtrip.wast b/test/lit/passes/roundtrip.wast
index a0288c600..3eca45655 100644
--- a/test/lit/passes/roundtrip.wast
+++ b/test/lit/passes/roundtrip.wast
@@ -2,6 +2,7 @@
;; RUN: wasm-opt %s -all --roundtrip -S -o - | filecheck %s
(module
+ ;; CHECK: (type $none (func))
(type $none (func))
;; CHECK: (func $foo
;; CHECK-NEXT: (local $0 (funcref (ref null $none)))
diff --git a/test/lit/passes/rse-eh.wast b/test/lit/passes/rse-eh.wast
index 7d21ef820..e8b9570ed 100644
--- a/test/lit/passes/rse-eh.wast
+++ b/test/lit/passes/rse-eh.wast
@@ -2,7 +2,9 @@
;; RUN: wasm-opt %s --rse -all -S -o - | filecheck %s
(module
+ ;; CHECK: (tag $e (param i32))
(tag $e (param i32))
+ ;; CHECK: (tag $e2 (param))
(tag $e2)
;; CHECK: (func $try1
@@ -99,7 +101,11 @@
(local.set $x (i32.const 1))
)
+ ;; CHECK: (func $foo
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
(func $foo)
+
;; CHECK: (func $try4
;; CHECK-NEXT: (local $x i32)
;; CHECK-NEXT: (try $try
diff --git a/test/lit/passes/simplify-locals-eh.wast b/test/lit/passes/simplify-locals-eh.wast
index 74501584c..9eb8680b0 100644
--- a/test/lit/passes/simplify-locals-eh.wast
+++ b/test/lit/passes/simplify-locals-eh.wast
@@ -2,6 +2,7 @@
;; RUN: wasm-opt %s --simplify-locals -all -S -o - | filecheck %s
(module
+ ;; CHECK: (tag $e-i32 (param i32))
(tag $e-i32 (param i32))
;; CHECK: (func $foo (param $0 i32) (param $1 i32)
;; CHECK-NEXT: (nop)
diff --git a/test/lit/passes/simplify-locals-gc.wast b/test/lit/passes/simplify-locals-gc.wast
index 4308a25a1..06822a5d7 100644
--- a/test/lit/passes/simplify-locals-gc.wast
+++ b/test/lit/passes/simplify-locals-gc.wast
@@ -3,6 +3,7 @@
;; RUN: | filecheck %s
(module
+ ;; CHECK: (type $struct (struct (field (mut i32))))
(type $struct (struct (field (mut i32))))
;; Writes to heap objects cannot be reordered with reads.
diff --git a/test/lit/passes/ssa.wast b/test/lit/passes/ssa.wast
index 6be5ee11a..30640a803 100644
--- a/test/lit/passes/ssa.wast
+++ b/test/lit/passes/ssa.wast
@@ -2,7 +2,11 @@
;; RUN: wasm-opt %s -all --ssa -S -o - | filecheck %s
(module
+ ;; CHECK: (func $foo
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
(func $foo)
+
;; CHECK: (func $bar (param $x (ref func))
;; CHECK-NEXT: (local $1 funcref)
;; CHECK-NEXT: (local $2 funcref)
diff --git a/test/lit/passes/stack-ir-eh.wast b/test/lit/passes/stack-ir-eh.wast
index 228f00773..b9e44174d 100644
--- a/test/lit/passes/stack-ir-eh.wast
+++ b/test/lit/passes/stack-ir-eh.wast
@@ -1,7 +1,9 @@
-;; RUN: wasm-opt %s --generate-stack-ir --optimize-stack-ir --print-stack-ir \
-;; RUN: -all -S -o - | filecheck %s
+;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
+;; RUN: wasm-opt %s --generate-stack-ir --optimize-stack-ir \
+;; RUN: -all --print-stack-ir | filecheck %s
(module
+ ;; CHECK: (tag $e0 (param i32))
(tag $e0 (param i32))
;; CHECK: (func $eh
@@ -9,7 +11,7 @@
;; CHECK-NEXT: i32.const 0
;; CHECK-NEXT: throw $e0
;; CHECK-NEXT: catch $e0
- ;; CHECK-NEXT:
+ ;; CHECK-NEXT:
;; CHECK-NEXT: drop
;; CHECK-NEXT: catch_all
;; CHECK-NEXT: rethrow $l0
diff --git a/test/lit/passes/vacuum-eh.wast b/test/lit/passes/vacuum-eh.wast
index a4417f0ae..ef6b6ff5b 100644
--- a/test/lit/passes/vacuum-eh.wast
+++ b/test/lit/passes/vacuum-eh.wast
@@ -2,7 +2,9 @@
;; RUN: wasm-opt %s --vacuum -all -S -o - | filecheck %s
(module
+ ;; CHECK: (tag $e (param i32))
(tag $e (param i32))
+ ;; CHECK: (tag $e2 (param i32))
(tag $e2 (param i32))
;; CHECK: (func $try-test