[PATCH] D94045: [WebAssembly] Ensure terminate pads are a single BB

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 11:31:01 PST 2021


tlively accepted this revision.
tlively added inline comments.


================
Comment at: llvm/test/CodeGen/WebAssembly/exception.ll:224
+; CHECK:      catch     $[[EXN:[0-9]+]]=, __cpp_exception
+; CHECK-NEXT: global.set  __stack_pointer
+; CHECK-NEXT: call  __clang_call_terminate, $[[EXN]]
----------------
aheejin wrote:
> tlively wrote:
> > Where does this `global.set` come from? If I understand the code correctly, the `call __clang_call_terminate` should have been directly after the `catch`.
> It is added in [[ https://github.com/llvm/llvm-project/blob/4e4df1e38d6b66083b3badb78e56b8b0f6045fd1/llvm/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp#L291 | restoreStackPointer ]] in LateEHPrepare. When [[ https://github.com/llvm/llvm-project/blob/4e4df1e38d6b66083b3badb78e56b8b0f6045fd1/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp#L92 | WebAssemblyFrameLowering::needsPrologForEH ]] returns true, i.e., a function has calls, `__stack_pointer` has to be saved in the function prolog and restored after each `catch`.
Makes sense, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94045



More information about the llvm-commits mailing list