[PATCH] MIR Parser: Report an error when a machine function doesn't have a corresponding function in the LLVM IR.
Alex Lorenz
arphaman at gmail.com
Mon Jun 15 17:48:01 PDT 2015
Hi dexonsmith, bob.wilson, bogner,
This patch reports an error when a machine function in the MIR file that has LLVM IR can't find a function with the same name in the loaded LLVM IR module.
REPOSITORY
rL LLVM
http://reviews.llvm.org/D10468
Files:
lib/CodeGen/MIRParser/MIRParser.cpp
test/CodeGen/MIR/machine-function-missing-function.mir
Index: lib/CodeGen/MIRParser/MIRParser.cpp
===================================================================
--- lib/CodeGen/MIRParser/MIRParser.cpp
+++ lib/CodeGen/MIRParser/MIRParser.cpp
@@ -173,6 +173,9 @@
Functions.insert(std::make_pair(FunctionName, std::move(MF)));
if (NoLLVMIR)
createDummyFunction(FunctionName, M);
+ else if (!M.getFunction(FunctionName))
+ return error(Twine("function '") + FunctionName +
+ "' isn't defined in the provided LLVM IR");
return false;
}
Index: test/CodeGen/MIR/machine-function-missing-function.mir
===================================================================
--- /dev/null
+++ test/CodeGen/MIR/machine-function-missing-function.mir
@@ -0,0 +1,19 @@
+# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s
+# This test ensures that an error is reported when the mir file has LLVM IR and
+# one of the machine functions has a name that doesn't match any function in
+# the LLVM IR.
+
+--- |
+
+ define i32 @foo() {
+ ret i32 0
+ }
+
+...
+---
+name: foo
+...
+---
+# CHECK: function 'faa' isn't defined in the provided LLVM IR
+name: faa
+...
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10468.27737.patch
Type: text/x-patch
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150616/f6e6ec5c/attachment.bin>
More information about the llvm-commits
mailing list