diff options
Diffstat (limited to 'test/lit')
-rw-r--r-- | test/lit/help/wasm-opt.test | 2 | ||||
-rw-r--r-- | test/lit/help/wasm2js.test | 2 | ||||
-rw-r--r-- | test/lit/passes/outlining.wast | 108 |
3 files changed, 112 insertions, 0 deletions
diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test index 95d25cc61..b18c312ff 100644 --- a/test/lit/help/wasm-opt.test +++ b/test/lit/help/wasm-opt.test @@ -317,6 +317,8 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --optimize-stack-ir optimize Stack IR ;; CHECK-NEXT: +;; CHECK-NEXT: --outlining outline instructions +;; CHECK-NEXT: ;; CHECK-NEXT: --pick-load-signs pick load signs based on their ;; CHECK-NEXT: uses ;; CHECK-NEXT: diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test index d3df47eb6..129374049 100644 --- a/test/lit/help/wasm2js.test +++ b/test/lit/help/wasm2js.test @@ -276,6 +276,8 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --optimize-stack-ir optimize Stack IR ;; CHECK-NEXT: +;; CHECK-NEXT: --outlining outline instructions +;; CHECK-NEXT: ;; CHECK-NEXT: --pick-load-signs pick load signs based on their ;; CHECK-NEXT: uses ;; CHECK-NEXT: diff --git a/test/lit/passes/outlining.wast b/test/lit/passes/outlining.wast new file mode 100644 index 000000000..d62570c11 --- /dev/null +++ b/test/lit/passes/outlining.wast @@ -0,0 +1,108 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. + +;; RUN: foreach %s %t wasm-opt --outlining -S -o - | filecheck %s + +;; TODO: Add a test that creates an outlined function with a sequence at beginning +;; TODO: Add a test that creates an outlined function with one return value +;; TODO: Add a test that creates an outlined function that no arguments +;; TODO: Add a test that creates an outlined function that returns multiple values +;; TODO: Add a test that makes sure we filter localSets correctly +;; TODO: Add a test that makes sure we filter localGets correctly +;; TODO: Add a test that makes sure we filter branches correctly +;; TODO: Add a test that makes sure we filter globals correctly +;; TODO: Add a test that fails to outline a single control flow that repeats + + +(module + ;; CHECK: (type $0 (func (result i32))) + + ;; CHECK: (type $1 (func (param i32))) + + ;; CHECK: (func $a (result i32) + ;; CHECK-NEXT: (call $outline$ + ;; CHECK-NEXT: (i32.const 7) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (return + ;; CHECK-NEXT: (i32.const 4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $a (result i32) + (drop (i32.const 7)) + (drop (i32.const 1)) + (drop (i32.const 2)) + (return (i32.const 4)) + ) + ;; CHECK: (func $b (result i32) + ;; CHECK-NEXT: (call $outline$ + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (return + ;; CHECK-NEXT: (i32.const 5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $b (result i32) + (drop (i32.const 0)) + (drop (i32.const 1)) + (drop (i32.const 2)) + (return (i32.const 5)) + ) +) + +;; Tests that outlining occurs properly when the sequence is at the end of a function. + +;; CHECK: (func $outline$ (param $0 i32) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (local.get $0) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (i32.const 1) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (i32.const 2) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +(module + ;; CHECK: (type $0 (func)) + + ;; CHECK: (type $1 (func (param i32))) + + ;; CHECK: (func $a + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.const 7) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (call $outline$ + ;; CHECK-NEXT: (i32.const 4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $a + (drop (i32.const 7)) + (drop (i32.const 4)) + (drop (i32.const 1)) + (drop (i32.const 2)) + ) + ;; CHECK: (func $b + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (call $outline$ + ;; CHECK-NEXT: (i32.const 5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $b + (drop (i32.const 0)) + (drop (i32.const 5)) + (drop (i32.const 1)) + (drop (i32.const 2)) + ) +) +;; CHECK: (func $outline$ (param $0 i32) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (local.get $0) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (i32.const 1) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (i32.const 2) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) |