summaryrefslogtreecommitdiff
path: root/test/lit/wasm-split
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/wasm-split')
-rw-r--r--test/lit/wasm-split/basic.wast10
-rw-r--r--test/lit/wasm-split/invalid-options.wast18
-rw-r--r--test/lit/wasm-split/profile-guided.wast19
3 files changed, 29 insertions, 18 deletions
diff --git a/test/lit/wasm-split/basic.wast b/test/lit/wasm-split/basic.wast
index 2291916a0..99bf17260 100644
--- a/test/lit/wasm-split/basic.wast
+++ b/test/lit/wasm-split/basic.wast
@@ -47,6 +47,12 @@
;; RUN: wasm-dis %t.split-bar.1.wasm | filecheck %s --check-prefix KEEP-FOO-PRIMARY
;; RUN: wasm-dis %t.split-bar.2.wasm | filecheck %s --check-prefix KEEP-FOO-SECONDARY
+;; Check workflow where --split-funcs supersede --keep-funcs
+;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.split-bar.1.wasm -o2 %t.split-bar.2.wasm --keep-funcs=@%S/both.txt --split-funcs=bar -v 2>&1 \
+;; RUN: | filecheck %s --check-prefix SPLIT-BAR-SUPERSEDE
+;; RUN: wasm-dis %t.split-bar.1.wasm | filecheck %s --check-prefix KEEP-FOO-PRIMARY
+;; RUN: wasm-dis %t.split-bar.2.wasm | filecheck %s --check-prefix KEEP-FOO-SECONDARY
+
(module
(table $table 1 1 funcref)
(elem (i32.const 0) $foo)
@@ -170,3 +176,7 @@
;; KEEP-BOTH-SECONDARY: (module
;; KEEP-BOTH-SECONDARY-NEXT: (import "primary" "%table" (table $table 1 1 funcref))
;; KEEP-BOTH-SECONDARY-NEXT: )
+
+;; SPLIT-BAR-SUPERSEDE: warning: function bar was to be kept in primary module. However it will now be split out into secondary module.
+;; SPLIT-BAR-SUPERSEDE: Keeping functions: foo{{$}}
+;; SPLIT-BAR-SUPERSEDE: Splitting out functions: bar{{$}}
diff --git a/test/lit/wasm-split/invalid-options.wast b/test/lit/wasm-split/invalid-options.wast
index c5a56b579..6d197adde 100644
--- a/test/lit/wasm-split/invalid-options.wast
+++ b/test/lit/wasm-split/invalid-options.wast
@@ -52,18 +52,6 @@
;; RUN: not wasm-split %s --merge-profiles -g 2>&1 \
;; RUN: | filecheck %s --check-prefix MERGE-DEBUGINFO
-;; --profile cannot be used with --keep-funcs
-;; RUN: not wasm-split %s --profile=foo --keep-funcs=foo 2>&1 \
-;; RUN: | filecheck %s --check-prefix PROFILE-KEEP
-
-;; --profile cannot be used with --split-funcs
-;; RUN: not wasm-split %s --profile=foo --split-funcs=foo 2>&1 \
-;; RUN: | filecheck %s --check-prefix PROFILE-SPLIT
-
-;; --keep-funcs cannot be used with --split-funcs
-;; RUN: not wasm-split %s --keep-funcs=foo --split-funcs=foo 2>&1 \
-;; RUN: | filecheck %s --check-prefix KEEP-SPLIT
-
;; INSTRUMENT-PROFILE: error: Option --profile cannot be used in instrument mode.
;; INSTRUMENT-OUT1: error: Option --primary-output cannot be used in instrument mode.
@@ -90,10 +78,4 @@
;; MERGE-DEBUGINFO: error: Option --debuginfo cannot be used in merge-profiles mode.
-;; PROFILE-KEEP: error: Cannot use both --profile and --keep-funcs.
-
-;; PROFILE-SPLIT: error: Cannot use both --profile and --split-funcs.
-
-;; KEEP-SPLIT: error: Cannot use both --keep-funcs and --split-funcs.
-
(module)
diff --git a/test/lit/wasm-split/profile-guided.wast b/test/lit/wasm-split/profile-guided.wast
index 6828c19fc..709ff4c8f 100644
--- a/test/lit/wasm-split/profile-guided.wast
+++ b/test/lit/wasm-split/profile-guided.wast
@@ -25,6 +25,12 @@
;; 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
+;; RUN: wasm-split -all %s --profile=%t.bar.prof --keep-funcs=uncalled -v -o1 %t.bar.1.wasm -o2 %t.bar.2.wasm \
+;; RUN: | filecheck %s --check-prefix PROFILE_KEEP
+
+;; RUN: wasm-split -all %s --profile=%t.both.prof --split-funcs=shared_callee -v -o1 %t.both.1.wasm -o2 %t.both.2.wasm 2>&1 \
+;; RUN: | filecheck %s --check-prefix PROFILE_SPLIT
+
;; =================================
;; Do it all again using --in-memory
;; =================================
@@ -52,6 +58,12 @@
;; 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
+;; RUN: wasm-split -all %s --profile=%t.bar.prof --keep-funcs=uncalled -v -o1 %t.bar.1.wasm -o2 %t.bar.2.wasm \
+;; RUN: | filecheck %s --check-prefix PROFILE_KEEP
+
+;; RUN: wasm-split -all %s --profile=%t.both.prof --split-funcs=shared_callee -v -o1 %t.both.1.wasm -o2 %t.both.2.wasm 2>&1 \
+;; RUN: | filecheck %s --check-prefix PROFILE_SPLIT
+
;; =======
;; Results
;; =======
@@ -68,6 +80,13 @@
;; NONE: Keeping functions:
;; NONE: Splitting out functions: bar, bar_callee, deep_foo_callee, foo, foo_callee, shared_callee, uncalled
+;; PROFILE_KEEP: Keeping functions: bar, bar_callee, shared_callee, uncalled
+;; PROFILE_KEEP: Splitting out functions: deep_foo_callee, foo, foo_callee
+
+;; PROFILE_SPLIT: warning: function shared_callee was to be kept in primary module. However it will now be split out into secondary module.
+;; PROFILE_SPLIT: Keeping functions: bar, bar_callee, deep_foo_callee, foo, foo_callee
+;; PROFILE_SPLIT: Splitting out functions: shared_callee, uncalled
+
(module
(memory $mem 1 1 shared)
(export "memory" (memory $mem))