[PATCH] D147504: [WebAssembly] `AsmTypeCheck` support to br instr
Congcong Cai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 9 11:32:32 PDT 2023
HerrCai0907 added inline comments.
================
Comment at: llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp:448-449
" missing .tagtype");
- // catch instruction pushes values whose types are specified in the tag's
- // "params" part
+ // if nest structure is good, last BrStack is operand stack in try instr;
+ Stack = BrStack.back().getEnterStack();
+ // catch instruction pushes values whose types are specified in the
----------------
aheejin wrote:
> I don't think we should restore try's `EnterStack` here? In a `catch` body, the only input params are the caught values, not the `try`'s input types.
The semantic of catch instructions in `try [T1->T2] catch [T3]` is [T2 -> T3].
If we don't restore the stack, we will get a incorrect stack after end_try.
For example
```
.tagtype TAG f32
i32.const 1
try i32
f32.const 1.0
throw TAG
// here ok because unreachable
drop
catch TAG
i32.trunc_f32_s
end_try
// here type stack is [i32, i32] but without restore we will get error
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147504/new/
https://reviews.llvm.org/D147504
More information about the llvm-commits
mailing list