[PATCH] D148054: [WebAssembly] `AsmTypeCheck` support to br instr
Heejin Ahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 11 23:01:17 PDT 2023
aheejin added a comment.
Thanks for the simplified version!
================
Comment at: llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp:143-145
+ if (Level == BrStack.size())
+ // br function body
+ return false;
----------------
I think it'd be better to start `BrStack` as the function return signature in the beginning than treating this as a special case. Currently we cannot check if the stack-remaining value types at the time of `br` matches the function return signature.
================
Comment at: llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp:146
+ return false;
+ SmallVector<wasm::ValType, 4> &Expected = BrStack[BrStack.size() - Level - 1];
+ if (Expected.size() > Stack.size())
----------------
================
Comment at: llvm/test/MC/WebAssembly/type-checker-errors.s:744
+ br 0
+ end_try
+ drop
----------------
`try`~`end_try` without a `catch`/`catch_all` is malformed.
================
Comment at: llvm/test/MC/WebAssembly/type-checker-errors.s:749-750
+br_invalid_type_catch:
+ .functype br_invalid_type_catch () -> ()
+
+ try f32
----------------
================
Comment at: llvm/test/MC/WebAssembly/type-checker-errors.s:772
+
+br_invalid_depth:
+ .functype br_invalid_depth () -> ()
----------------
Can we add a few more tests on the depth?
1. When the depth is +1 than the max possible depth (including the function boundary) (incorrect)
2. When the depth targets the function boundary (correct)
3. When the depth targets the function boundary, but the signature doesn't match (incorrect)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148054/new/
https://reviews.llvm.org/D148054
More information about the llvm-commits
mailing list