From c8704b02df54ff109f3fe28798aed5ff8b8ecb29 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Thu, 9 Jul 2015 21:21:33 +0000 Subject: MIR Parser: Report an error when parsing machine function with an empty body. This commit adds a new error which is reported when the MIR Parser encounters a machine function without any machine basic blocks. The machine verifier expects that the machine functions have at least one MBB, and this error will prevent machine functions without MBBs from reaching the machine verifier and crashing with an assertion. llvm-svn: 241862 --- llvm/lib/CodeGen/MIRParser/MIRParser.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/CodeGen/MIRParser') diff --git a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp index e505ab4baeb..e5ba0322235 100644 --- a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp @@ -275,6 +275,9 @@ bool MIRParserImpl::initializeMachineFunction(MachineFunction &MF) { Twine(YamlMBB.ID)); } + if (YamlMF.BasicBlocks.empty()) + return error(Twine("machine function '") + Twine(MF.getName()) + + "' requires at least one machine basic block in its body"); // Initialize the machine basic blocks after creating them all so that the // machine instructions parser can resolve the MBB references. unsigned I = 0; -- cgit v1.2.3