[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
Loading
Please sign in to comment