[all-commits] [llvm/llvm-project] 20c1d9: [WebAssembly] Handle cleanuppad with no parent in ...

Heejin Ahn via All-commits all-commits at lists.llvm.org
Thu Jan 27 21:11:03 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 20c1d9ce5ece40ec779f3e5898a369fce9c7ba0b
      https://github.com/llvm/llvm-project/commit/20c1d9ce5ece40ec779f3e5898a369fce9c7ba0b
  Author: Heejin Ahn <aheejin at gmail.com>
  Date:   2022-01-27 (Thu, 27 Jan 2022)

  Changed paths:
    M llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
    M llvm/test/CodeGen/WebAssembly/lower-wasm-ehsjlj.ll

  Log Message:
  -----------
  [WebAssembly] Handle cleanuppad with no parent in Wasm SjLj

Wasm SjLj converts longjmpable calls into `invoke`s that unwind to
`%catch.longjmp.dispatch` BB, from where we check if the thrown
exception is a `longjmp`. But in case a call already has a `funclet`
attribute, i.e., it is within a catch scope, we have to unwind to its
unwind destination first to preserve the scoping structure. That will
eventually unwind to `%catch.longjmp.dispatch`, because all
`catchswitch` and `cleanupret` that unwind to caller are redirected to
`%catch.dispatch.longjmp` during Wasm SjLj transformation.

But the prevous code assumed `cleanuppad`'s parent pad was always an
instruction, and didn't handle when a `cleanuppad`'s parent is `none`.
This CL handles this case, and makes the `while` loop more intuitive by
removing `FromPad` condition and explicitly inserting `break`s.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D118407




More information about the All-commits mailing list