Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print castType for unreachable br_on_cast{_fail} #7107

Merged
merged 1 commit into from
Nov 22, 2024
Merged
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
10 changes: 4 additions & 6 deletions src/passes/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2221,10 +2221,9 @@ struct PrintExpressionContents
o << ' ';
if (curr->ref->type == Type::unreachable) {
// Need to print some reference type in the correct hierarchy rather
// than unreachable, and the bottom type is valid in the most
// contexts.
printType(
Type(curr->castType.getHeapType().getBottom(), NonNullable));
// than unreachable, and the cast type itself is the best possible
// option.
printType(curr->castType);
} else {
printType(curr->ref->type);
}
Expand All @@ -2236,8 +2235,7 @@ struct PrintExpressionContents
curr->name.print(o);
o << ' ';
if (curr->ref->type == Type::unreachable) {
printType(
Type(curr->castType.getHeapType().getBottom(), NonNullable));
printType(curr->castType);
} else {
printType(curr->ref->type);
}
Expand Down
4 changes: 2 additions & 2 deletions test/lit/wat-kitchen-sink.wast
Original file line number Diff line number Diff line change
Expand Up @@ -4069,7 +4069,7 @@
;; CHECK-NEXT: (block $block (result i31ref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result (ref any))
;; CHECK-NEXT: (br_on_cast $block (ref none) i31ref
;; CHECK-NEXT: (br_on_cast $block i31ref i31ref
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
Expand Down Expand Up @@ -4119,7 +4119,7 @@
;; CHECK-NEXT: (block $block (result (ref any))
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i31ref)
;; CHECK-NEXT: (br_on_cast_fail $block (ref none) i31ref
;; CHECK-NEXT: (br_on_cast_fail $block i31ref i31ref
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
Expand Down
Loading