Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tlively committed Jan 26, 2024
1 parent acd2480 commit 42ff291
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 49 deletions.
12 changes: 6 additions & 6 deletions test/gtest/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ TEST_F(CFGTest, LinearReachingDefinitions) {
auto moduleText = R"wasm(
(module
(func $bar
(local $a (i32))
(local $b (i32))
(local $c (i32))
(local $a i32)
(local $b i32)
(local $c i32)
(local.set $a
(i32.const 1)
)
Expand Down Expand Up @@ -335,8 +335,8 @@ TEST_F(CFGTest, ReachingDefinitionsIf) {
auto moduleText = R"wasm(
(module
(func $bar
(local $a (i32))
(local $b (i32))
(local $a i32)
(local $b i32)
(local.set $a
(i32.const 1)
)
Expand Down Expand Up @@ -406,7 +406,7 @@ TEST_F(CFGTest, ReachingDefinitionsIf) {
TEST_F(CFGTest, ReachingDefinitionsLoop) {
auto moduleText = R"wasm(
(module
(func $bar (param $a (i32)) (param $b (i32))
(func $bar (param $a i32) (param $b i32)
(loop $loop
(drop
(local.get $a)
Expand Down
8 changes: 4 additions & 4 deletions test/lit/blocktype.wast
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; RTRIP: (func $f1 (type $f1) (result (ref $f1) (ref $f2))
;; RTRIP-NEXT: (local $0 ((ref $f1) (ref $f2)))
;; RTRIP-NEXT: (local $1 ((ref $f1) (ref $f2)))
;; RTRIP-NEXT: (local $0 (tuple (ref $f1) (ref $f2)))
;; RTRIP-NEXT: (local $1 (tuple (ref $f1) (ref $f2)))
;; RTRIP-NEXT: (local.set $1
;; RTRIP-NEXT: (loop $label$1 (type $f1) (result (ref $f1) (ref $f2))
;; RTRIP-NEXT: (local.set $0
Expand Down Expand Up @@ -64,8 +64,8 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; RTRIP: (func $f2 (type $f2) (result (ref $f2) (ref $f1))
;; RTRIP-NEXT: (local $0 ((ref $f2) (ref $f1)))
;; RTRIP-NEXT: (local $1 ((ref $f2) (ref $f1)))
;; RTRIP-NEXT: (local $0 (tuple (ref $f2) (ref $f1)))
;; RTRIP-NEXT: (local $1 (tuple (ref $f2) (ref $f1)))
;; RTRIP-NEXT: (local.set $1
;; RTRIP-NEXT: (loop $label$1 (type $f2) (result (ref $f2) (ref $f1))
;; RTRIP-NEXT: (local.set $0
Expand Down
2 changes: 1 addition & 1 deletion test/lit/multivalue-stack-ir.wast
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test
(local $pair (f32 i32))
(local $pair (tuple f32 i32))
(local $f32 f32)
;; Normally this get-set pair would be eliminated by stack IR optimizations,
;; but then the binary writer's tuple optimizations would leave the only the
Expand Down
32 changes: 16 additions & 16 deletions test/lit/multivalue.wast
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
;; CHECK: (import "env" "pair" (func $pair (type $0) (result i32 i64)))
(import "env" "pair" (func $pair (result i32 i64)))
;; CHECK: (global $g1 (mut i32) (i32.const 0))
(global $g1 (mut (i32 i64)) (tuple.make 2 (i32.const 0) (i64.const 0)))
(global $g1 (mut (tuple i32 i64)) (tuple.make 2 (i32.const 0) (i64.const 0)))
;; CHECK: (global $g2 (mut i64) (i64.const 0))
(global $g2 (i32 i64) (tuple.make 2 (i32.const 0) (i64.const 0)))
(global $g2 (tuple i32 i64) (tuple.make 2 (i32.const 0) (i64.const 0)))

;; CHECK: (func $triple (type $5) (result i32 i64 f32)
;; CHECK-NEXT: (tuple.make 3
Expand All @@ -28,7 +28,7 @@
)

;; CHECK: (func $get-first (type $6) (result i32)
;; CHECK-NEXT: (local $0 (i32 i64 f32))
;; CHECK-NEXT: (local $0 (tuple i32 i64 f32))
;; CHECK-NEXT: (local $1 i64)
;; CHECK-NEXT: (local $2 i32)
;; CHECK-NEXT: (local.set $0
Expand Down Expand Up @@ -66,7 +66,7 @@

;; CHECK: (func $get-second (type $3) (result i64)
;; CHECK-NEXT: (local $0 i64)
;; CHECK-NEXT: (local $1 (i32 i64 f32))
;; CHECK-NEXT: (local $1 (tuple i32 i64 f32))
;; CHECK-NEXT: (local $2 i64)
;; CHECK-NEXT: (local $3 i32)
;; CHECK-NEXT: (local.set $1
Expand Down Expand Up @@ -107,7 +107,7 @@

;; CHECK: (func $get-third (type $7) (result f32)
;; CHECK-NEXT: (local $0 f32)
;; CHECK-NEXT: (local $1 (i32 i64 f32))
;; CHECK-NEXT: (local $1 (tuple i32 i64 f32))
;; CHECK-NEXT: (local $2 i64)
;; CHECK-NEXT: (local $3 i32)
;; CHECK-NEXT: (local.set $1
Expand Down Expand Up @@ -152,7 +152,7 @@
;; CHECK-NEXT: (local $2 i64)
;; CHECK-NEXT: (local $3 f32)
;; CHECK-NEXT: (local $4 f32)
;; CHECK-NEXT: (local $5 (i32 i64 f32))
;; CHECK-NEXT: (local $5 (tuple i32 i64 f32))
;; CHECK-NEXT: (local $6 i64)
;; CHECK-NEXT: (local $7 i32)
;; CHECK-NEXT: (local.set $5
Expand Down Expand Up @@ -190,7 +190,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $reverse (result f32 i64 i32)
(local $x (i32 i64 f32))
(local $x (tuple i32 i64 f32))
(local.set $x
(call $triple)
)
Expand Down Expand Up @@ -266,7 +266,7 @@

;; Test lowering of multivalue drops
;; CHECK: (func $drop-call (type $1)
;; CHECK-NEXT: (local $0 (i32 i64))
;; CHECK-NEXT: (local $0 (tuple i32 i64))
;; CHECK-NEXT: (local $1 i32)
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (call $pair)
Expand Down Expand Up @@ -317,7 +317,7 @@
)

;; CHECK: (func $drop-block (type $1)
;; CHECK-NEXT: (local $0 (i32 i64))
;; CHECK-NEXT: (local $0 (tuple i32 i64))
;; CHECK-NEXT: (local $1 i32)
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (block $label$1 (type $0) (result i32 i64)
Expand Down Expand Up @@ -392,7 +392,7 @@
)

;; CHECK: (func $mv-block-break (type $0) (result i32 i64)
;; CHECK-NEXT: (local $0 (i32 i64))
;; CHECK-NEXT: (local $0 (tuple i32 i64))
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (block $label$1 (type $0) (result i32 i64)
;; CHECK-NEXT: (br $label$1
Expand Down Expand Up @@ -424,8 +424,8 @@
)

;; CHECK: (func $mv-block-br-if (type $0) (result i32 i64)
;; CHECK-NEXT: (local $0 (i32 i64))
;; CHECK-NEXT: (local $1 (i32 i64))
;; CHECK-NEXT: (local $0 (tuple i32 i64))
;; CHECK-NEXT: (local $1 (tuple i32 i64))
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (block $label$1 (type $0) (result i32 i64)
;; CHECK-NEXT: (local.set $0
Expand Down Expand Up @@ -469,7 +469,7 @@
)

;; CHECK: (func $mv-if (type $2) (result i32 i64 externref)
;; CHECK-NEXT: (local $0 (i32 i64 externref))
;; CHECK-NEXT: (local $0 (tuple i32 i64 externref))
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (if (type $2) (result i32 i64 externref)
;; CHECK-NEXT: (i32.const 1)
Expand Down Expand Up @@ -522,7 +522,7 @@
)

;; CHECK: (func $mv-loop (type $0) (result i32 i64)
;; CHECK-NEXT: (local $0 (i32 i64))
;; CHECK-NEXT: (local $0 (tuple i32 i64))
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (loop $label$1 (type $0) (result i32 i64)
;; CHECK-NEXT: (tuple.make 2
Expand Down Expand Up @@ -550,8 +550,8 @@
)

;; CHECK: (func $mv-switch (type $0) (result i32 i64)
;; CHECK-NEXT: (local $0 (i32 i64))
;; CHECK-NEXT: (local $1 (i32 i64))
;; CHECK-NEXT: (local $0 (tuple i32 i64))
;; CHECK-NEXT: (local $1 (tuple i32 i64))
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (block $label$1 (type $0) (result i32 i64)
;; CHECK-NEXT: (local.set $0
Expand Down
30 changes: 15 additions & 15 deletions test/lit/passes/translate-eh-old-to-new.wast
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
;; CHECK: (func $try-none-tag-single-with-rethrow (type $1)
;; CHECK-NEXT: (local $0 exnref)
;; CHECK-NEXT: (local $1 i32)
;; CHECK-NEXT: (local $2 (i32 exnref))
;; CHECK-NEXT: (local $2 (tuple i32 exnref))
;; CHECK-NEXT: (block $outer0
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (block $catch_all2 (result exnref)
Expand Down Expand Up @@ -205,7 +205,7 @@
)

;; CHECK: (func $try-none-tag-tuple (type $1)
;; CHECK-NEXT: (local $0 (i32 i64))
;; CHECK-NEXT: (local $0 (tuple i32 i64))
;; CHECK-NEXT: (block $outer0
;; CHECK-NEXT: (block $catch_all2
;; CHECK-NEXT: (local.set $0
Expand Down Expand Up @@ -243,8 +243,8 @@

;; CHECK: (func $try-none-tag-tuple-with-rethrow (type $1)
;; CHECK-NEXT: (local $0 exnref)
;; CHECK-NEXT: (local $1 (i32 i64))
;; CHECK-NEXT: (local $2 (i32 i64 exnref))
;; CHECK-NEXT: (local $1 (tuple i32 i64))
;; CHECK-NEXT: (local $2 (tuple i32 i64 exnref))
;; CHECK-NEXT: (block $outer0
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (block $catch_all2 (result exnref)
Expand Down Expand Up @@ -419,7 +419,7 @@
;; CHECK: (func $try-single-tag-single-with-rethrow (type $2) (result i32)
;; CHECK-NEXT: (local $0 exnref)
;; CHECK-NEXT: (local $1 i32)
;; CHECK-NEXT: (local $2 (i32 exnref))
;; CHECK-NEXT: (local $2 (tuple i32 exnref))
;; CHECK-NEXT: (block $outer0 (result i32)
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (block $catch_all2 (result exnref)
Expand Down Expand Up @@ -481,7 +481,7 @@
)

;; CHECK: (func $try-single-tag-tuple (type $2) (result i32)
;; CHECK-NEXT: (local $0 (i32 i64))
;; CHECK-NEXT: (local $0 (tuple i32 i64))
;; CHECK-NEXT: (block $outer0 (result i32)
;; CHECK-NEXT: (block $catch_all2
;; CHECK-NEXT: (local.set $0
Expand Down Expand Up @@ -527,8 +527,8 @@

;; CHECK: (func $try-single-tag-tuple-with-rethrow (type $2) (result i32)
;; CHECK-NEXT: (local $0 exnref)
;; CHECK-NEXT: (local $1 (i32 i64))
;; CHECK-NEXT: (local $2 (i32 i64 exnref))
;; CHECK-NEXT: (local $1 (tuple i32 i64))
;; CHECK-NEXT: (local $2 (tuple i32 i64 exnref))
;; CHECK-NEXT: (block $outer0 (result i32)
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (block $catch_all2 (result exnref)
Expand Down Expand Up @@ -751,7 +751,7 @@
;; CHECK: (func $try-tuple-tag-single-with-rethrow (type $0) (result i32 i64)
;; CHECK-NEXT: (local $0 exnref)
;; CHECK-NEXT: (local $1 i32)
;; CHECK-NEXT: (local $2 (i32 exnref))
;; CHECK-NEXT: (local $2 (tuple i32 exnref))
;; CHECK-NEXT: (block $outer0 (type $0) (result i32 i64)
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (block $catch_all2 (result exnref)
Expand Down Expand Up @@ -819,7 +819,7 @@
)

;; CHECK: (func $try-tuple-tag-tuple (type $0) (result i32 i64)
;; CHECK-NEXT: (local $0 (i32 i64))
;; CHECK-NEXT: (local $0 (tuple i32 i64))
;; CHECK-NEXT: (block $outer0 (type $0) (result i32 i64)
;; CHECK-NEXT: (block $catch_all2
;; CHECK-NEXT: (local.set $0
Expand Down Expand Up @@ -869,8 +869,8 @@

;; CHECK: (func $try-tuple-tag-tuple-with-rethrow (type $0) (result i32 i64)
;; CHECK-NEXT: (local $0 exnref)
;; CHECK-NEXT: (local $1 (i32 i64))
;; CHECK-NEXT: (local $2 (i32 i64 exnref))
;; CHECK-NEXT: (local $1 (tuple i32 i64))
;; CHECK-NEXT: (local $2 (tuple i32 i64 exnref))
;; CHECK-NEXT: (block $outer0 (type $0) (result i32 i64)
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (block $catch_all2 (result exnref)
Expand Down Expand Up @@ -961,9 +961,9 @@
;; CHECK: (func $multiple-catches-and-catch_all (type $1)
;; CHECK-NEXT: (local $0 exnref)
;; CHECK-NEXT: (local $1 i32)
;; CHECK-NEXT: (local $2 (i32 i64))
;; CHECK-NEXT: (local $3 (i32 exnref))
;; CHECK-NEXT: (local $4 (i32 i64 exnref))
;; CHECK-NEXT: (local $2 (tuple i32 i64))
;; CHECK-NEXT: (local $3 (tuple i32 exnref))
;; CHECK-NEXT: (local $4 (tuple i32 i64 exnref))
;; CHECK-NEXT: (block $outer0
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (block $catch_all4 (result exnref)
Expand Down
2 changes: 1 addition & 1 deletion test/lit/validation/bad-non-nullable-locals.wast
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
(func $tuple
;; Since this tuple local has a non-nullable element, it is subject to the
;; non-nullability rules.
(local $x (i32 (ref any) i64))
(local $x (tuple i32 (ref any) i64))
(tuple.drop 3
(local.get $x)
)
Expand Down
2 changes: 1 addition & 1 deletion test/lit/validation/nn-locals-bad-call_ref.wast
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)
(catch $tag
(drop
(pop (i32))
(pop i32)
)
;; The path to here is from a possible exception thrown in the call_ref.
;; This is a regression test for call_ref not being seen as possibly
Expand Down
8 changes: 4 additions & 4 deletions test/lit/wat-kitchen-sink.wast
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@

;; CHECK: (func $block-mix (type $void)
;; CHECK-NEXT: (local $scratch i32)
;; CHECK-NEXT: (local $scratch_1 (i32 i32))
;; CHECK-NEXT: (local $scratch_1 (tuple i32 i32))
;; CHECK-NEXT: (local $scratch_2 i32)
;; CHECK-NEXT: (block $0
;; CHECK-NEXT: (drop
Expand Down Expand Up @@ -1019,7 +1019,7 @@


;; CHECK: (func $multivalue-nested (type $ret2) (result i32 i32)
;; CHECK-NEXT: (local $scratch (i32 i32))
;; CHECK-NEXT: (local $scratch (tuple i32 i32))
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: (local.set $scratch
;; CHECK-NEXT: (block (type $ret2) (result i32 i32)
Expand Down Expand Up @@ -3754,9 +3754,9 @@
;; CHECK-NEXT: (local $0 (ref null $void))
;; CHECK-NEXT: (local $1 (ref null $ret2))
;; CHECK-NEXT: (local $2 (ref null $many))
;; CHECK-NEXT: (local $scratch (i32 i32))
;; CHECK-NEXT: (local $scratch (tuple i32 i32))
;; CHECK-NEXT: (local $scratch_4 i32)
;; CHECK-NEXT: (local $scratch_5 (anyref (ref func)))
;; CHECK-NEXT: (local $scratch_5 (tuple anyref (ref func)))
;; CHECK-NEXT: (local $scratch_6 anyref)
;; CHECK-NEXT: (call_ref $void
;; CHECK-NEXT: (local.get $0)
Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_poppy_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_incompatible_type(self):
)
'''
self.check_invalid(module, "block element has incompatible type")
self.check_invalid(module, "required: (i32 i32), available: (f32 i32)")
self.check_invalid(module, "required: (tuple i32 i32), available: (tuple f32 i32)")

def test_incorrect_pop_type(self):
module = '''
Expand Down

0 comments on commit 42ff291

Please sign in to comment.