[llvm] 4e8b2ac - [WebAssembly] Fix bug where -no-type-check failed to completely disable the typechecker
Alex Bradbury via llvm-commits
llvm-commits at lists.llvm.org
Thu May 19 02:08:10 PDT 2022
Author: Alex Bradbury
Date: 2022-05-19T10:06:02+01:00
New Revision: 4e8b2ac7c01982f05d10e100299dadb5d4c79c5e
URL: https://github.com/llvm/llvm-project/commit/4e8b2ac7c01982f05d10e100299dadb5d4c79c5e
DIFF: https://github.com/llvm/llvm-project/commit/4e8b2ac7c01982f05d10e100299dadb5d4c79c5e.diff
LOG: [WebAssembly] Fix bug where -no-type-check failed to completely disable the typechecker
Related to <https://github.com/llvm/llvm-project/issues/55566>.
Committing directly (per LLVM's code review policy) as this is a trivial
fix.
Added:
llvm/test/MC/WebAssembly/type-checker-disabled.s
Modified:
llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
index 8da0a4ccc35a..65de65e59b37 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
@@ -1103,7 +1103,8 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
}
void onEndOfFunction(SMLoc ErrorLoc) {
- TC.endOfFunction(ErrorLoc);
+ if (!SkipTypeCheck)
+ TC.endOfFunction(ErrorLoc);
// Reset the type checker state.
TC.Clear();
diff --git a/llvm/test/MC/WebAssembly/type-checker-disabled.s b/llvm/test/MC/WebAssembly/type-checker-disabled.s
new file mode 100644
index 000000000000..deb5725f76ac
--- /dev/null
+++ b/llvm/test/MC/WebAssembly/type-checker-disabled.s
@@ -0,0 +1,13 @@
+# RUN: llvm-mc -triple=wasm32 -no-type-check %s 2>&1
+
+# Check no errors are produced when type checking is disabled.
+
+correctly_typed:
+ .functype correctly_typed () -> (i32)
+ i32.const 1
+ end_function
+
+incorrectly_typed:
+ .functype incorrectly_typed () -> (i32)
+ nop
+ end_function
More information about the llvm-commits
mailing list