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

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 13:46:24 PDT 2020


tlively added a comment.

In D81055#2071862 <https://reviews.llvm.org/D81055#2071862>, @aheejin wrote:

> I'm not very familiar with how wasm debugger works, but do they use `unreachable` for breakpoints? Binaryen assumes `unreachable` is really unreachable and does all sorts of optimizations including DCE and everything, so if `unreachable` is actually used in debugger, that seems risky..?


No, WebAssembly does not any sort of debugger instruction (although JS does). On other targets without dedicated debugger instructions, debugtrap is lowered to a normal trap, so that is what we are doing here. In fact, there is target-independent code to automatically change debug traps to normal traps before ISel when debugtrap is not supported. So this is the correct lowering to do, given that we don't have a debugger instruction. The reason the target-independent mechanism doesn't work for us is that it assumes the trap will lower to a non-terminator instruction.


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