summaryrefslogtreecommitdiff
path: root/test/lit/help
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2023-06-15 17:20:28 -0700
committerGitHub <noreply@github.com>2023-06-15 17:20:28 -0700
commita317958d3026632dcdeda5cc9850fd79dda59e9d (patch)
treec29462ee3b12e4c9deeab7ab65fe096f15da2572 /test/lit/help
parent599a9627ce88b66eeb4e2be24163fa62f0533743 (diff)
downloadbinaryen-a317958d3026632dcdeda5cc9850fd79dda59e9d.tar.gz
binaryen-a317958d3026632dcdeda5cc9850fd79dda59e9d.tar.bz2
binaryen-a317958d3026632dcdeda5cc9850fd79dda59e9d.zip
[EH] Add pass to remove EH instructions (#5770)
This pass strips all EH stuff, including EH instructions and tags, from the input module and disables the EH feature from the features section. 1. This removes `catch` and `catch_all` blocks from the code. So ```wast (try (do (some code) ) (catch ... ) ) ``` becomes just `(some code)`. Note that all `rethrow`s will be removed with `catch`es. Note that all `rethrow`s will be removed with `catch`es. 2. This converts 'throw (...)` into `unreachable`. Note that `rethrows 3. This removes all tags from the module, which are unused anyway after 1 and 2. 4. This removes exception handling feature from the features section. You can use the pass with ```console $ wasm-opt --enable-exception-handling --strip-eh INPUT -o OUTPUT ``` This is not an optimization pass, so it is not run unless you specify the pass explicitly. This is in effect similar to Clang's `-fignore-exceptions`, in which you can throw but it will result in a crash and we compile away all landing pads. This can be used for people who don't (or can't) use `-fignore-exceptions` in their build settings or who want to compile away `catch` blocks later. Closes emscripten-core/emscripten#19585.
Diffstat (limited to 'test/lit/help')
-rw-r--r--test/lit/help/wasm-opt.test2
-rw-r--r--test/lit/help/wasm2js.test2
2 files changed, 4 insertions, 0 deletions
diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test
index 2e10ed073..30369e62f 100644
--- a/test/lit/help/wasm-opt.test
+++ b/test/lit/help/wasm-opt.test
@@ -452,6 +452,8 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --strip-dwarf strip dwarf debug info
;; CHECK-NEXT:
+;; CHECK-NEXT: --strip-eh strip EH instructions
+;; CHECK-NEXT:
;; CHECK-NEXT: --strip-producers strip the wasm producers section
;; CHECK-NEXT:
;; CHECK-NEXT: --strip-target-features strip the wasm target features
diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test
index 1766d771d..916dbbb4d 100644
--- a/test/lit/help/wasm2js.test
+++ b/test/lit/help/wasm2js.test
@@ -411,6 +411,8 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --strip-dwarf strip dwarf debug info
;; CHECK-NEXT:
+;; CHECK-NEXT: --strip-eh strip EH instructions
+;; CHECK-NEXT:
;; CHECK-NEXT: --strip-producers strip the wasm producers section
;; CHECK-NEXT:
;; CHECK-NEXT: --strip-target-features strip the wasm target features