Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/passes/StripEH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ struct StripEHImpl : public WalkerPass<PostWalker<StripEHImpl>> {
refinalize = true;
}

void visitTryTable(TryTable* curr) {
replaceCurrent(curr->body);
refinalize = true;
}

void visitFunction(Function* curr) {
if (refinalize) {
ReFinalize().walkFunctionInModule(curr, getModule());
Expand Down
35 changes: 35 additions & 0 deletions test/lit/passes/strip-eh.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
;; RUN: wasm-opt %s -all --strip-eh -S -o - | filecheck %s

;; Remove all EH instructions and tags. Converts 'throw's into 'unreachable's.

(module
(tag $e-i32 (param i32))
(tag $e-f32 (param f32))

;; CHECK: (func $throw-i32 (type $0)
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
(func $throw-i32
(throw $e-i32 (i32.const 0))
)
;; CHECK: (func $throw-f32 (type $0)
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
(func $throw-f32
(throw $e-f32 (f32.const 0.0))
)

;; CHECK: (func $try-catch (type $0)
;; CHECK-NEXT: (block $out
;; CHECK-NEXT: (call $throw-f32)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $try-catch
(block $out
(try_table (catch_all $out)
(call $throw-f32)
)
)
)
)
Loading