Fix br_on_cast parsing with non-nullable extra values - #9036
Conversation
tlively
left a comment
There was a problem hiding this comment.
Thanks! LGTM with the test updated.
| ;; RUN: wasm-opt %s -all -S -o %t | ||
| ;; RUN: wasm-opt %s -all --roundtrip -S -o %t.roundtrip |
There was a problem hiding this comment.
Please update the test to include the expected output. After updating the RUN line, you can use scripts/update_lit_checks.py to generate the expectations.
| ;; RUN: wasm-opt %s -all -S -o %t | |
| ;; RUN: wasm-opt %s -all --roundtrip -S -o %t.roundtrip | |
| ;; RUN: wasm-opt %s -all --roundtrip -S -o - | filecheck %s |
There was a problem hiding this comment.
Updated the test to pipe the roundtrip output through FileCheck and generated the expected output with scripts/update_lit_checks.py. The focused lit tests pass locally.
| TypeUpdating::handleNonDefaultableLocals( | ||
| f, decls.wasm, firstScratchLocal); |
There was a problem hiding this comment.
Let's not worry about the firstScratchLocal optimization and just call handleNonDefaultableLocals as-is. It's ok if it fixes locals that were used invalidly in the input; there are a few similar cases where we end up parsing and accepting invalid modules.
Fixes #8949.
Text parsing did not normalize synthesized non-defaultable scratch locals after finishing each function, unlike binary reading. This applies the existing fixup and preserves exact reference types when building nullable-output br_on_cast fallthrough values.
Tests: