[PATCH] D81055: [WebAssembly] Lower llvm.debugtrap properly

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 20:21:43 PDT 2020


aheejin added a comment.

In D81055#2072399 <https://reviews.llvm.org/D81055#2072399>, @dschuff wrote:

> Binaryen doesn't assume an `unreachable` is actually unreachable, the way C compilers do, does it? (and remove code before the unreachable)? I think it just knows that instructions that come after it are unreachable and removes those. I think it's ok once it's lowered to wasm unreachable; it really won't be able to return (and so Binaryen can do DCE), but that seems like a legit behavior for @llvm.debugtrap according to the langref.


Yeah you're right. I was confused; Binaryen's DCE only removes the code after `unreachable` is unreachable. But doesn't `debugtrap` instruction expect the control flow to return? That's why I was wondering if we can translate `debugtrap` to `unreachable`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81055





More information about the llvm-commits mailing list