diff options
author | Thomas Lively <tlively@google.com> | 2024-09-17 11:49:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-17 11:49:45 -0700 |
commit | f9b64c8c5d9ad720304e101dc58790f3bbfdfc3c (patch) | |
tree | 0f0f319ed0d543a86712ec3fc0fe7877f0eacc8b /test/lit/wasm-split | |
parent | 0da6d3e5b729e1fe7cc608720dc3d428fefcdb03 (diff) | |
download | binaryen-f9b64c8c5d9ad720304e101dc58790f3bbfdfc3c.tar.gz binaryen-f9b64c8c5d9ad720304e101dc58790f3bbfdfc3c.tar.bz2 binaryen-f9b64c8c5d9ad720304e101dc58790f3bbfdfc3c.zip |
[wasm-split] Simplify handling of --keep-funcs and --split-funcs (#6948)
Maintain the invariant that every defined functions belongs to either
the set of kept functions or the set of split functions. Functions are
kept by default except when --keep-funcs is specified without
--split-funcs on the command line. This is mostly NFC except that it
changes the default behavior when no arguments are specified on the
command line to keep all functions.
This will simplify a follow-on PR that switches from passing the kept
functions to the module splitting utility to passing the split
functions.
Diffstat (limited to 'test/lit/wasm-split')
-rw-r--r-- | test/lit/wasm-split/basic.wast | 12 | ||||
-rw-r--r-- | test/lit/wasm-split/jspi-secondary-export.wast | 2 | ||||
-rw-r--r-- | test/lit/wasm-split/profile-guided.wast | 1 |
3 files changed, 7 insertions, 8 deletions
diff --git a/test/lit/wasm-split/basic.wast b/test/lit/wasm-split/basic.wast index 1390f1a63..9af64daed 100644 --- a/test/lit/wasm-split/basic.wast +++ b/test/lit/wasm-split/basic.wast @@ -1,11 +1,6 @@ ;; RUN: not wasm-split %s --export-prefix='%' -g -o1 %t.none.1.wasm -o2 %t.none.2.wasm --keep-funcs=@failed-to-open.txt -v 2>&1 \ ;; RUN: | filecheck %s --check-prefix FAILED-TO-OPEN -;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.none.1.wasm -o2 %t.none.2.wasm -v 2>&1 \ -;; RUN: | filecheck %s --check-prefix KEEP-NONE -;; RUN: wasm-dis %t.none.1.wasm | filecheck %s --check-prefix KEEP-NONE-PRIMARY -;; RUN: wasm-dis %t.none.2.wasm | filecheck %s --check-prefix KEEP-NONE-SECONDARY - ;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.none.1.wasm -o2 %t.none.2.wasm --keep-funcs=@%S/none.txt -v 2>&1 \ ;; RUN: | filecheck %s --check-prefix KEEP-NONE ;; RUN: wasm-dis %t.none.1.wasm | filecheck %s --check-prefix KEEP-NONE-PRIMARY @@ -31,6 +26,11 @@ ;; RUN: wasm-dis %t.bar.1.wasm | filecheck %s --check-prefix KEEP-BAR-PRIMARY ;; RUN: wasm-dis %t.bar.2.wasm | filecheck %s --check-prefix KEEP-BAR-SECONDARY +;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.none.1.wasm -o2 %t.none.2.wasm -v 2>&1 \ +;; RUN: | filecheck %s --check-prefix KEEP-BOTH +;; RUN: wasm-dis %t.none.1.wasm | filecheck %s --check-prefix KEEP-BOTH-PRIMARY +;; RUN: wasm-dis %t.none.2.wasm | filecheck %s --check-prefix KEEP-BOTH-SECONDARY + ;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.both.1.wasm -o2 %t.both.2.wasm --keep-funcs=foo,bar -v 2>&1 \ ;; RUN: | filecheck %s --check-prefix KEEP-BOTH ;; RUN: wasm-dis %t.both.1.wasm | filecheck %s --check-prefix KEEP-BOTH-PRIMARY @@ -176,6 +176,6 @@ ;; KEEP-BOTH-SECONDARY: (module ;; 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: warning: function bar was to be both kept and split. It will be split. ;; SPLIT-BAR-SUPERSEDE: Keeping functions: foo{{$}} ;; SPLIT-BAR-SUPERSEDE: Splitting out functions: bar{{$}} diff --git a/test/lit/wasm-split/jspi-secondary-export.wast b/test/lit/wasm-split/jspi-secondary-export.wast index 6e89bab28..435863438 100644 --- a/test/lit/wasm-split/jspi-secondary-export.wast +++ b/test/lit/wasm-split/jspi-secondary-export.wast @@ -1,5 +1,5 @@ ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. -;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.1.wasm -o2 %t.2.wasm --jspi +;; RUN: wasm-split %s --export-prefix='%' -g -o1 %t.1.wasm -o2 %t.2.wasm --jspi --split-funcs=foo,bar ;; RUN: wasm-dis %t.1.wasm | filecheck %s --check-prefix PRIMARY ;; RUN: wasm-dis %t.2.wasm | filecheck %s --check-prefix SECONDARY diff --git a/test/lit/wasm-split/profile-guided.wast b/test/lit/wasm-split/profile-guided.wast index 709ff4c8f..9ee259754 100644 --- a/test/lit/wasm-split/profile-guided.wast +++ b/test/lit/wasm-split/profile-guided.wast @@ -83,7 +83,6 @@ ;; 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 |