summaryrefslogtreecommitdiff
path: root/src/tools/wasm-split/split-options.cpp
diff options
context:
space:
mode:
authorBenjamin Ling <serenade.mint@gmail.com>2024-07-11 02:35:27 +0800
committerGitHub <noreply@github.com>2024-07-10 11:35:27 -0700
commit76f661203f98820ebc6840ecf627a5eafc038403 (patch)
tree5da3797654f8a4da1fced8adf8b268a7dd81f7a5 /src/tools/wasm-split/split-options.cpp
parent0750bdbc1f7c356a160493acdb8dc314a68f1f12 (diff)
downloadbinaryen-76f661203f98820ebc6840ecf627a5eafc038403.tar.gz
binaryen-76f661203f98820ebc6840ecf627a5eafc038403.tar.bz2
binaryen-76f661203f98820ebc6840ecf627a5eafc038403.zip
Allow --keepfuncs and --splitfuncs to be use alongside a profile data (#6322)
There are times after collecting a profile, we wish to manually include specific functions into the primary module. It could be due to non-deterministic profiling or functions for error scenarios (e.g. _trap). This PR helps to unlock this workflow by honoring both the `--keep-funcs` flag as well as the `--profile` flag
Diffstat (limited to 'src/tools/wasm-split/split-options.cpp')
-rw-r--r--src/tools/wasm-split/split-options.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/tools/wasm-split/split-options.cpp b/src/tools/wasm-split/split-options.cpp
index b166b575c..9a9351998 100644
--- a/src/tools/wasm-split/split-options.cpp
+++ b/src/tools/wasm-split/split-options.cpp
@@ -129,7 +129,7 @@ WasmSplitOptions::WasmSplitOptions()
.add("--keep-funcs",
"",
"Comma-separated list of functions to keep in the primary module. The "
- "rest will be split out. Cannot be used with --profile or "
+ "rest will be split out. Can be used alongside --profile and "
"--split-funcs. You can also pass a file with one function per line "
"by passing @filename.",
WasmSplitOption,
@@ -141,8 +141,9 @@ WasmSplitOptions::WasmSplitOptions()
.add("--split-funcs",
"",
"Comma-separated list of functions to split out to the secondary "
- "module. The rest will be kept. Cannot be used with --profile or "
- "--keep-funcs. You can also pass a file with one function per line "
+ "module. The rest will be kept. Can be used alongside --profile and "
+ "--keep-funcs. This takes precedence over other split options. "
+ "You can also pass a file with one function per line "
"by passing @filename.",
WasmSplitOption,
{Mode::Split},
@@ -421,18 +422,6 @@ bool WasmSplitOptions::validate() {
}
}
- if (mode == Mode::Split) {
- if (profileFile.size() && keepFuncs.size()) {
- fail("Cannot use both --profile and --keep-funcs.");
- }
- if (profileFile.size() && splitFuncs.size()) {
- fail("Cannot use both --profile and --split-funcs.");
- }
- if (keepFuncs.size() && splitFuncs.size()) {
- fail("Cannot use both --keep-funcs and --split-funcs.");
- }
- }
-
return valid;
}