Skip to content

Commit ada1581

Browse files
authored
[NFC] Improve wasm-opt help text (#7631)
Add an example + wiki links.
1 parent 14d117f commit ada1581

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/tools/wasm-opt.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,21 @@ int main(int argc, const char* argv[]) {
9595

9696
const std::string WasmOptOption = "wasm-opt options";
9797

98-
OptimizationOptions options("wasm-opt", "Read, write, and optimize files");
98+
OptimizationOptions options("wasm-opt",
99+
R"(Read, write, and optimize files.
100+
101+
Example usage:
102+
103+
wasm-opt input.wasm -O3 -o output.wasm
104+
105+
This reads an input wasm file, optimizes with -O3, and writes out the result.
106+
107+
For more on how to optimize effectively, see
108+
109+
https://github.com/WebAssembly/binaryen/wiki/Optimizer-Cookbook
110+
https://github.com/WebAssembly/binaryen/wiki/GC-Optimization-Guidebook
111+
)");
112+
99113
options
100114
.add("--output",
101115
"-o",

test/lit/help/wasm-opt.test

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@
22
;; CHECK: ================================================================================
33
;; CHECK-NEXT: wasm-opt INFILE
44
;; CHECK-NEXT:
5-
;; CHECK-NEXT: Read, write, and optimize files
5+
;; CHECK-NEXT: Read, write, and optimize files.
6+
;; CHECK-NEXT:
7+
;; CHECK-NEXT: Example usage:
8+
;; CHECK-NEXT:
9+
;; CHECK-NEXT: wasm-opt input.wasm -O3 -o output.wasm
10+
;; CHECK-NEXT:
11+
;; CHECK-NEXT: This reads an input wasm file, optimizes with -O3, and writes out the result.
12+
;; CHECK-NEXT:
13+
;; CHECK-NEXT: For more on how to optimize effectively, see
14+
;; CHECK-NEXT:
15+
;; CHECK-NEXT: https://github.com/WebAssembly/binaryen/wiki/Optimizer-Cookbook
16+
;; CHECK-NEXT: https://github.com/WebAssembly/binaryen/wiki/GC-Optimization-Guidebook
17+
;; CHECK-NEXT:
618
;; CHECK-NEXT: ================================================================================
719
;; CHECK-NEXT:
820
;; CHECK-NEXT:

0 commit comments

Comments
 (0)