[llvm] r239774 - MIR Serialization: Report an error when machine functions have the same name.
Alex Lorenz
arphaman at gmail.com
Mon Jun 15 15:23:24 PDT 2015
Author: arphaman
Date: Mon Jun 15 17:23:23 2015
New Revision: 239774
URL: http://llvm.org/viewvc/llvm-project?rev=239774&view=rev
Log:
MIR Serialization: Report an error when machine functions have the same name.
This commit reports an error when the MIR parser encounters a machine
function with the name that is the same as the name of a different
machine function.
Reviewers: Duncan P. N. Exon Smith
Differential Revision: http://reviews.llvm.org/D10130
Added:
llvm/trunk/test/CodeGen/MIR/machine-function-redefinition-error.mir
Modified:
llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp
Modified: llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp?rev=239774&r1=239773&r2=239774&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MIRParser.cpp Mon Jun 15 17:23:23 2015
@@ -156,6 +156,9 @@ bool MIRParserImpl::parseMachineFunction
if (In.error())
return true;
auto FunctionName = MF->Name;
+ if (Functions.find(FunctionName) != Functions.end())
+ return error(Twine("redefinition of machine function '") + FunctionName +
+ "'");
Functions.insert(std::make_pair(FunctionName, std::move(MF)));
return false;
}
Added: llvm/trunk/test/CodeGen/MIR/machine-function-redefinition-error.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/machine-function-redefinition-error.mir?rev=239774&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/MIR/machine-function-redefinition-error.mir (added)
+++ llvm/trunk/test/CodeGen/MIR/machine-function-redefinition-error.mir Mon Jun 15 17:23:23 2015
@@ -0,0 +1,10 @@
+# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s
+# This test ensures that the machine function errors are reported correctly.
+
+---
+name: foo
+...
+---
+# CHECK: redefinition of machine function 'foo'
+name: foo
+...
More information about the llvm-commits
mailing list