diff options
| author | Heejin Ahn <aheejin@gmail.com> | 2021-08-26 12:25:03 -0700 |
|---|---|---|
| committer | Heejin Ahn <aheejin@gmail.com> | 2021-08-26 17:25:26 -0700 |
| commit | f5cff292e297ad5094f35d6223a199e389adcd99 (patch) | |
| tree | ecce7fc4724150a5ca50a5aaa5d81af9cc4f0d38 /libcxx/include/__algorithm/reverse.h | |
| parent | 3784fc493eb254bbed422f0bc83f01bee94a8195 (diff) | |
| download | llvm-f5cff292e297ad5094f35d6223a199e389adcd99.zip llvm-f5cff292e297ad5094f35d6223a199e389adcd99.tar.gz llvm-f5cff292e297ad5094f35d6223a199e389adcd99.tar.bz2 | |
[WebAssembly] Fix PHI when relaying longjmps
When doing Emscritpen EH, if SjLj is also enabled and used and if the
thrown exception has a possiblity being a longjmp instead of an
exception, we shouldn't swallow it; we should rethrow, or relay it. It
was done in D106525 and the code is here:
https://github.com/llvm/llvm-project/blob/8441a8eea8007b9eaaaabf76055949180a702d6d/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp#L858-L898
Here is the pseudocode of that part: (copied from comments)
```
if (%__THREW__.val == 0 || %__THREW__.val == 1)
goto %tail
else
goto %longjmp.rethrow
longjmp.rethrow: ;; This is longjmp. Rethrow it
%__threwValue.val = __threwValue
emscripten_longjmp(%__THREW__.val, %__threwValue.val);
tail: ;; Nothing happened or an exception is thrown
... Continue exception handling ...
```
If the current BB (where the `invoke` is created) has successors that
has the current BB as its PHI incoming node, now that has to change to
`tail` in the pseudocode, because `tail` is the latest BB that is
connected with the next BB, but this was missing.
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D108785
Diffstat (limited to 'libcxx/include/__algorithm/reverse.h')
0 files changed, 0 insertions, 0 deletions
