diff options
Diffstat (limited to 'test/lit/wasm-split/profile-guided.wast')
-rw-r--r-- | test/lit/wasm-split/profile-guided.wast | 66 |
1 files changed, 49 insertions, 17 deletions
diff --git a/test/lit/wasm-split/profile-guided.wast b/test/lit/wasm-split/profile-guided.wast index f2d79f99c..4a96ef55e 100644 --- a/test/lit/wasm-split/profile-guided.wast +++ b/test/lit/wasm-split/profile-guided.wast @@ -1,43 +1,75 @@ +;; ===================== ;; Instrument the binary +;; ===================== -;; RUN: wasm-split --instrument %s -o %t.instrumented.wasm +;; RUN: wasm-split -all --instrument %s -o %t.instrumented.wasm ;; Create profiles -;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.foo.prof foo -;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.bar.prof bar -;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.both.prof foo bar -;; RUN: node %S/call_exports.mjs %t.instrumented.wasm %t.none.prof +;; RUN: node --experimental-wasm-threads %S/call_exports.mjs %t.instrumented.wasm %t.foo.prof foo +;; RUN: node --experimental-wasm-threads %S/call_exports.mjs %t.instrumented.wasm %t.bar.prof bar +;; RUN: node --experimental-wasm-threads %S/call_exports.mjs %t.instrumented.wasm %t.both.prof foo bar +;; RUN: node --experimental-wasm-threads %S/call_exports.mjs %t.instrumented.wasm %t.none.prof ;; Create profile-guided splits -;; RUN: wasm-split %s --profile=%t.foo.prof -v -o1 %t.foo.1.wasm -o2 %t.foo.2.wasm \ +;; RUN: wasm-split -all %s --profile=%t.foo.prof -v -o1 %t.foo.1.wasm -o2 %t.foo.2.wasm \ ;; RUN: | filecheck %s --check-prefix FOO -;; FOO: Keeping functions: deep_foo_callee, foo, foo_callee, shared_callee -;; FOO: Splitting out functions: bar, bar_callee, uncalled +;; RUN: wasm-split -all %s --profile=%t.bar.prof -v -o1 %t.bar.1.wasm -o2 %t.bar.2.wasm \ +;; RUN: | filecheck %s --check-prefix BAR + +;; RUN: wasm-split -all %s --profile=%t.both.prof -v -o1 %t.both.1.wasm -o2 %t.both.2.wasm \ +;; RUN: | filecheck %s --check-prefix BOTH + +;; RUN: wasm-split -all %s --profile=%t.none.prof -v -o1 %t.none.1.wasm -o2 %t.none.2.wasm \ +;; RUN: | filecheck %s --check-prefix NONE + +;; ================================= +;; Do it all again using --in-memory +;; ================================= -;; RUN: wasm-split %s --profile=%t.bar.prof -v -o1 %t.bar.1.wasm -o2 %t.bar.2.wasm \ +;; RUN: wasm-split -all --instrument --in-memory %s -o %t.instrumented.wasm + +;; Create profiles + +;; RUN: node --experimental-wasm-threads %S/call_exports.mjs %t.instrumented.wasm %t.foo.prof foo +;; RUN: node --experimental-wasm-threads %S/call_exports.mjs %t.instrumented.wasm %t.bar.prof bar +;; RUN: node --experimental-wasm-threads %S/call_exports.mjs %t.instrumented.wasm %t.both.prof foo bar +;; RUN: node --experimental-wasm-threads %S/call_exports.mjs %t.instrumented.wasm %t.none.prof + +;; Create profile-guided splits + +;; RUN: wasm-split -all %s --profile=%t.foo.prof -v -o1 %t.foo.1.wasm -o2 %t.foo.2.wasm \ +;; RUN: | filecheck %s --check-prefix FOO + +;; RUN: wasm-split -all %s --profile=%t.bar.prof -v -o1 %t.bar.1.wasm -o2 %t.bar.2.wasm \ ;; RUN: | filecheck %s --check-prefix BAR +;; RUN: wasm-split -all %s --profile=%t.both.prof -v -o1 %t.both.1.wasm -o2 %t.both.2.wasm \ +;; RUN: | filecheck %s --check-prefix BOTH + +;; RUN: wasm-split -all %s --profile=%t.none.prof -v -o1 %t.none.1.wasm -o2 %t.none.2.wasm \ +;; RUN: | filecheck %s --check-prefix NONE + +;; ======= +;; Results +;; ======= + +;; FOO: Keeping functions: deep_foo_callee, foo, foo_callee, shared_callee +;; FOO: Splitting out functions: bar, bar_callee, uncalled + ;; BAR: Keeping functions: bar, bar_callee, shared_callee ;; BAR: Splitting out functions: deep_foo_callee, foo, foo_callee, uncalled -;; RUN: wasm-split %s --profile=%t.both.prof -v -o1 %t.both.1.wasm -o2 %t.both.2.wasm \ -;; RUN: | filecheck %s --check-prefix BOTH - ;; BOTH: Keeping functions: bar, bar_callee, deep_foo_callee, foo, foo_callee, shared_callee ;; BOTH: Splitting out functions: uncalled -;; RUN: wasm-split %s --profile=%t.none.prof -v -o1 %t.none.1.wasm -o2 %t.none.2.wasm \ -;; RUN: | filecheck %s --check-prefix NONE - ;; NONE: Keeping functions: ;; NONE: Splitting out functions: bar, bar_callee, deep_foo_callee, foo, foo_callee, shared_callee, uncalled - (module - (memory $mem 1 1) + (memory $mem (shared 1 1)) (export "memory" (memory $mem)) (export "foo" (func $foo)) (export "bar" (func $bar)) |