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

[WebAssembly] Print instructions with type checking errors #111067

Merged
merged 1 commit into from
Oct 4, 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
Original file line number Diff line number Diff line change
Expand Up @@ -1157,8 +1157,8 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
Inst.setOpcode(Opc64);
}
}
if (!SkipTypeCheck && TC.typeCheck(IDLoc, Inst, Operands))
return true;
if (!SkipTypeCheck)
TC.typeCheck(IDLoc, Inst, Operands);
Out.emitInstruction(Inst, getSTI());
if (CurrentState == EndFunction) {
onEndOfFunction(IDLoc);
Expand Down
11 changes: 11 additions & 0 deletions llvm/test/MC/WebAssembly/annotations-typecheck.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# RUN: not llvm-mc -triple=wasm32-unknown-unknown < %s | FileCheck %s
Copy link
Member

Choose a reason for hiding this comment

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

so this means that the assembly as a whole still fails, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

It fails because type checking fails. But at least InstPrinter and its annotation printer is not printing confusing messages.


# This tests annotations are handled correctly even if there is a type checking
# error (which are unrelated to the block annotations).
test_annotation:
.functype test_annotation () -> ()
block (i32) -> ()
drop
# CHECK-NOT: # End marker mismatch!
end_block
end_function
Loading