[PATCH] D67208: [WebAssembly] Add -fwasm-exceptions for wasm EH

Heejin Ahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 5 16:16:38 PDT 2019


aheejin added a comment.

In D67208#1659972 <https://reviews.llvm.org/D67208#1659972>, @dschuff wrote:

> If this is to be like `-fdwarf-exceptions` I assume the idea is that eventually it will default on when targeting wasm, and become one of those flags that most users never set. In that case it really just selects the default exception model, and thus it should be compatible with `-fno-exceptions` just as `-fdwarf-exceptions` is.\


`-fwasm-exceptions` works fine with `-fno-exceptions`. That has the same effect as when you specify both `-fdwarf-exceptions` and `-fno-exceptions` together; it just lowers invokes to calls. Is that not what you mean?

> Also `-fno-exceptions` doesn't really mean "no exceptions whatsoever" because IIRC if you call something that the compiler isn't sure never throws, it generates an implicit catch-all that calls `std::terminate`. So how it does that would still be affected by the exception model. (and whatever downstream invoke-removing pass or postprocessing tool might care).

`-fno-exceptions` does not generate try-catch with calls to `std::terminate`. The native x86 compiler does not do that either. It just assumes exceptions don't exist. (And you can't use keywords like `try`, `catch`, or `throw` with `-fno-exceptions`.) What you described is when we use `noexcept` on the function declaration but the function calls another function that can throw, I think.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67208/new/

https://reviews.llvm.org/D67208





More information about the cfe-commits mailing list