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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239774
91177308-0d34-0410-b5e6-
96231b3b80d8
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;
}
--- /dev/null
+# 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
+...