[WebAssembly] Correctly check end_if/end_try with else/catch
authorHeejin Ahn <aheejin@gmail.com>
Sun, 9 Apr 2023 10:28:15 +0000 (03:28 -0700)
committerHeejin Ahn <aheejin@gmail.com>
Tue, 11 Apr 2023 09:07:45 +0000 (02:07 -0700)
commit86c65fc4aa783071925e92340585456d7580dbf6
tree7c5b9455bbafdabcb88639c9df9a414e0539b0cb
parent3e9881b92b090577ac1e8964d0504a455a306ca9
[WebAssembly] Correctly check end_if/end_try with else/catch

When we encounter an `else`, `catch`, or `catch_all`, we currently just
push the structure `NestingType` and don't preserve the original `if`
and `try`'s signature. So after we pass `else`/`catch`/`catch_all`, we
can't check if the values on stack have the correct types when we
encounter `end_if` or `end_try`. This CL fixes the issue, and modifies
the existing test to be correct (some of them had `try` without
`catch`).

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D147881
llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
llvm/test/MC/WebAssembly/type-checker-errors.s