diff options
author | Thomas Lively <tlively@google.com> | 2023-10-02 16:09:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-02 16:09:05 -0700 |
commit | 0fe08192d866f72d0f4e680c862bb7af48dec1ac (patch) | |
tree | a37b814de2ab85a64612ea112b6303776a44bfa7 /src/wasm/wasm-validator.cpp | |
parent | 77f36789aac707d1d5daed20e6e7612c9a9af51b (diff) | |
download | binaryen-0fe08192d866f72d0f4e680c862bb7af48dec1ac.tar.gz binaryen-0fe08192d866f72d0f4e680c862bb7af48dec1ac.tar.bz2 binaryen-0fe08192d866f72d0f4e680c862bb7af48dec1ac.zip |
[Parser] Parse labels and br (#5970)
The parser previously parsed labels and could attach them to control flow
structures, but did not maintain the context necessary to correctly parse
branches. Support parsing labels as both names and indices in IRBuilder,
handling shadowing correctly, and use that support to implement parsing of br.
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index a8bb4a536..337065b91 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -651,8 +651,11 @@ void FunctionValidator::visitBlock(Block* curr) { auto iter = breakTypes.find(curr->name); assert(iter != breakTypes.end()); // we set it ourselves for (Type breakType : iter->second) { - // none or unreachable means a poison value that we should ignore - if - // consumed, it will error + if (breakType == Type::none && curr->type == Type::unreachable) { + // We allow empty breaks to unreachable blocks. + continue; + } + shouldBeSubType(breakType, curr->type, curr, |