Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/parser/parse-5-defs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include "wat-parser-internal.h"

#include "ir/type-updating.h"

namespace wasm::WATParser {

Result<> parseDefinitions(
Expand Down Expand Up @@ -63,6 +65,7 @@ Result<> parseDefinitions(
if (auto* err = end.getErr()) {
return ctx.in.err(decls.funcDefs[i].pos, err->msg);
}
TypeUpdating::handleNonDefaultableLocals(f, decls.wasm);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/wasm/wasm-ir-builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2302,7 +2302,7 @@ Result<> IRBuilder::makeBrOn(Index label,
case BrOnCast:
case BrOnCastDescEq:
if (out->isNullable()) {
resultType = Type(in->getHeapType(), NonNullable);
resultType = in->with(NonNullable);
} else {
resultType = *in;
}
Expand Down
17 changes: 17 additions & 0 deletions test/lit/basic/br-on-cast-extra-values.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
;; RUN: wasm-opt %s -all -S -o %t
;; RUN: wasm-opt %s -all --roundtrip -S -o %t.roundtrip
Comment on lines +1 to +2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
;; 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


(module
(type $s (struct))
(func (param $s (ref $s)) (result (ref $s) (ref $s))
local.get $s
local.get $s
br_on_cast 0 (ref $s) (ref $s)
)
(func (param $s (ref (exact $s)))
(result (ref (exact $s)) (ref null (exact $s)))
local.get $s
local.get $s
br_on_cast 0 (ref (exact $s)) (ref null (exact $s))
)
)
Loading