diff options
Diffstat (limited to 'test/lit')
5 files changed, 82 insertions, 27 deletions
diff --git a/test/lit/merge/chain.wat b/test/lit/merge/chain.wat index 76004e9bd..528b20d0e 100644 --- a/test/lit/merge/chain.wat +++ b/test/lit/merge/chain.wat @@ -13,8 +13,12 @@ ;; CHECK: (export "g" (func $0)) -;; CHECK: (export "h" (func $0)) +;; CHECK: (export "h" (func $0_2)) ;; CHECK: (func $0 (type $0) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) + +;; CHECK: (func $0_2 (type $0) +;; CHECK-NEXT: (call $0) +;; CHECK-NEXT: ) diff --git a/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast b/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast index 907891aee..e0045579d 100644 --- a/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast +++ b/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast @@ -18,7 +18,7 @@ ;; CHECK: (export "t1" (func $t1)) - ;; CHECK: (export "t2" (func $fib)) + ;; CHECK: (export "t2" (func $t2)) ;; CHECK: (export "t3" (func $t3)) @@ -155,6 +155,11 @@ ) ) ) + ;; CHECK: (func $t2 (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK-NEXT: (call $fib + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) (func $t2 (export "t2") (type $t0) (param $p0 i32) (result i32) (call $fib (local.get $p0) diff --git a/test/lit/passes/extract-function.wast b/test/lit/passes/extract-function.wast index e4b804abe..9258f8c63 100644 --- a/test/lit/passes/extract-function.wast +++ b/test/lit/passes/extract-function.wast @@ -5,6 +5,15 @@ ;; RUN: foreach %s %t wasm-opt --extract-function-index --pass-arg=extract-function-index@0 -S -o - | filecheck %s (module + ;; CHECK: (type $0 (func)) + + ;; CHECK: (import "env" "bar" (func $bar)) + + ;; CHECK: (export "foo" (func $foo)) + + ;; CHECK: (func $foo + ;; CHECK-NEXT: (call $bar) + ;; CHECK-NEXT: ) (func $foo (call $bar) ) @@ -18,11 +27,6 @@ ) ) -;; CHECK: (type $0 (func)) - -;; CHECK: (import "env" "bar" (func $bar)) - -;; CHECK: (export "foo" (func $bar)) (module ;; Use another function in the table, but the table is not used in the ;; extracted function diff --git a/test/lit/passes/remove-unused-module-elements-refs.wast b/test/lit/passes/remove-unused-module-elements-refs.wast index 377639e51..00ea9767f 100644 --- a/test/lit/passes/remove-unused-module-elements-refs.wast +++ b/test/lit/passes/remove-unused-module-elements-refs.wast @@ -656,18 +656,24 @@ (ref.func $d) )) + ;; CHECK: (export "export" (func $export)) + + ;; CHECK: (func $export (type $void) + ;; CHECK-NEXT: (call $b) + ;; CHECK-NEXT: ) + ;; OPEN_WORLD: (export "export" (func $export)) + + ;; OPEN_WORLD: (func $export (type $void) + ;; OPEN_WORLD-NEXT: (call $b) + ;; OPEN_WORLD-NEXT: ) (func $export (export "export") ;; Call $b but not $a or $c (call $b) ) - ;; CHECK: (export "export" (func $b)) - ;; CHECK: (func $a (type $void) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) - ;; OPEN_WORLD: (export "export" (func $b)) - ;; OPEN_WORLD: (func $a (type $void) ;; OPEN_WORLD-NEXT: (call_ref $void ;; OPEN_WORLD-NEXT: (struct.get $vtable 0 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 b5c5d701e..efa9ece60 100644 --- a/test/lit/passes/remove-unused-module-elements_all-features.wast +++ b/test/lit/passes/remove-unused-module-elements_all-features.wast @@ -19,7 +19,7 @@ ;; CHECK: (export "memory" (memory $0)) - ;; CHECK: (export "exported" (func $called2)) + ;; CHECK: (export "exported" (func $exported)) ;; CHECK: (export "other1" (func $other1)) @@ -64,6 +64,9 @@ (func $called_indirect (type $0) (nop) ) + ;; CHECK: (func $exported (type $0) + ;; CHECK-NEXT: (call $called2) + ;; CHECK-NEXT: ) (func $exported (type $0-dupe) (call $called2) ) @@ -456,15 +459,15 @@ (func $waka) ;; used in table ) (module ;; one is exported, and one->two->int global, whose init->imported - ;; CHECK: (type $0 (func (param i32) (result i32))) + ;; CHECK: (type $0 (func (result i32))) - ;; CHECK: (type $1 (func (result i32))) + ;; CHECK: (type $1 (func)) - ;; CHECK: (type $2 (func)) + ;; CHECK: (type $2 (func (param i32) (result i32))) ;; CHECK: (import "env" "imported" (global $imported i32)) (import "env" "imported" (global $imported i32)) - ;; CHECK: (import "env" "_puts" (func $_puts (type $0) (param i32) (result i32))) + ;; CHECK: (import "env" "_puts" (func $_puts (type $2) (param i32) (result i32))) (import "env" "forgetme" (global $forgetme i32)) (import "env" "_puts" (func $_puts (param i32) (result i32))) (import "env" "forget_puts" (func $forget_puts (param i32) (result i32))) @@ -475,26 +478,32 @@ (global $forglobal.get (mut i32) (i32.const 500)) ;; CHECK: (global $exp_glob i32 (i32.const 600)) (global $exp_glob i32 (i32.const 600)) - ;; CHECK: (export "one" (func $two)) + ;; CHECK: (export "one" (func $one)) (export "one" (func $one)) - ;; CHECK: (export "three" (func $four)) + ;; CHECK: (export "three" (func $three)) (export "three" (func $three)) ;; CHECK: (export "exp_glob" (global $exp_glob)) (export "exp_glob" (global $exp_glob)) (start $starter) + ;; CHECK: (func $one (type $0) (result i32) + ;; CHECK-NEXT: (call $two) + ;; CHECK-NEXT: ) (func $one (result i32) (call $two) ) - ;; CHECK: (func $two (type $1) (result i32) + ;; CHECK: (func $two (type $0) (result i32) ;; CHECK-NEXT: (global.get $int) ;; CHECK-NEXT: ) (func $two (result i32) (global.get $int) ) + ;; CHECK: (func $three (type $1) + ;; CHECK-NEXT: (call $four) + ;; CHECK-NEXT: ) (func $three (call $four) ) - ;; CHECK: (func $four (type $2) + ;; CHECK: (func $four (type $1) ;; CHECK-NEXT: (global.set $set ;; CHECK-NEXT: (i32.const 200) ;; CHECK-NEXT: ) @@ -766,19 +775,25 @@ ;; CHECK: (export "export-import" (func $import)) (export "export-import" (func $import)) - ;; CHECK: (export "export-middle" (func $import)) + ;; CHECK: (export "export-middle" (func $middle)) (export "export-middle" (func $middle)) - ;; CHECK: (export "export-other-middle" (func $internal)) + ;; CHECK: (export "export-other-middle" (func $other-middle)) (export "export-other-middle" (func $other-middle)) ;; CHECK: (export "export-internal" (func $internal)) (export "export-internal" (func $internal)) + ;; CHECK: (func $middle (type $0) + ;; CHECK-NEXT: (call $import) + ;; CHECK-NEXT: ) (func $middle (call $import) ) + ;; CHECK: (func $other-middle (type $0) + ;; CHECK-NEXT: (call $internal) + ;; CHECK-NEXT: ) (func $other-middle (call $internal) ) @@ -812,7 +827,7 @@ ;; CHECK: (export "export-import-B" (func $import-B)) (export "export-import-B" (func $import-B)) - ;; CHECK: (export "export-middle-A-A" (func $import-A)) + ;; CHECK: (export "export-middle-A-A" (func $middle-A-A)) (export "export-middle-A-A" (func $middle-A-A)) ;; CHECK: (export "export-middle-A-B" (func $middle-A-B)) @@ -821,9 +836,12 @@ ;; CHECK: (export "export-middle-B-A" (func $middle-B-A)) (export "export-middle-B-A" (func $middle-B-A)) - ;; CHECK: (export "export-middle-B-B" (func $import-B)) + ;; CHECK: (export "export-middle-B-B" (func $middle-B-B)) (export "export-middle-B-B" (func $middle-B-B)) + ;; CHECK: (func $middle-A-A (type $A) + ;; CHECK-NEXT: (call $import-A) + ;; CHECK-NEXT: ) (func $middle-A-A (type $A) (call $import-A) ) @@ -842,6 +860,9 @@ (call $import-A) ) + ;; CHECK: (func $middle-B-B (type $B) + ;; CHECK-NEXT: (call $import-B) + ;; CHECK-NEXT: ) (func $middle-B-B (type $B) (call $import-B) ) @@ -858,7 +879,7 @@ ;; CHECK: (export "export-import" (func $import)) (export "export-import" (func $import)) - ;; CHECK: (export "export-middle" (func $import)) + ;; CHECK: (export "export-middle" (func $middle)) (export "export-middle" (func $middle)) ;; CHECK: (export "export-middle-local" (func $middle-local)) @@ -870,6 +891,12 @@ ;; CHECK: (export "export-middle-noncall" (func $middle-noncall)) (export "export-middle-noncall" (func $middle-noncall)) + ;; CHECK: (func $middle (type $0) (param $x i32) + ;; CHECK-NEXT: (local $y i32) + ;; CHECK-NEXT: (call $import + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) (func $middle (param $x i32) ;; This extra local is not a problem. (local $y i32) @@ -927,12 +954,18 @@ ;; CHECK: (import "a" "b" (func $import (type $0) (param i32 i32) (result f64))) (import "a" "b" (func $import (param i32) (param i32) (result f64))) - ;; CHECK: (export "export-middle-right" (func $import)) + ;; CHECK: (export "export-middle-right" (func $middle-right)) (export "export-middle-right" (func $middle-right)) ;; CHECK: (export "export-middle-wrong" (func $middle-wrong)) (export "export-middle-wrong" (func $middle-wrong)) + ;; CHECK: (func $middle-right (type $0) (param $x i32) (param $y i32) (result f64) + ;; CHECK-NEXT: (call $import + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: (local.get $y) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) (func $middle-right (param $x i32) (param $y i32) (result f64) (call $import (local.get $x) @@ -963,9 +996,12 @@ ;; CHECK: (import "a" "b" (func $import (type $0))) (import "a" "b" (func $import)) - ;; CHECK: (export "export-middle" (func $import)) + ;; CHECK: (export "export-middle" (func $middle)) (export "export-middle" (func $middle)) + ;; CHECK: (func $middle (type $0) + ;; CHECK-NEXT: (return_call $import) + ;; CHECK-NEXT: ) (func $middle (return_call $import) ) |