diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIRParser.cpp | 3 | ||||
-rw-r--r-- | llvm/test/CodeGen/MIR/llvmIR.mir | 2 | ||||
-rw-r--r-- | llvm/test/CodeGen/MIR/llvmIRMissing.mir | 2 | ||||
-rw-r--r-- | llvm/test/CodeGen/MIR/machine-function-missing-body-error.mir | 15 | ||||
-rw-r--r-- | llvm/test/CodeGen/MIR/machine-function-missing-function.mir | 4 | ||||
-rw-r--r-- | llvm/test/CodeGen/MIR/machine-function-missing-name.mir | 4 | ||||
-rw-r--r-- | llvm/test/CodeGen/MIR/machine-function.mir | 8 | ||||
-rw-r--r-- | llvm/test/CodeGen/MIR/register-info.mir | 4 |
8 files changed, 42 insertions, 0 deletions
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; diff --git a/llvm/test/CodeGen/MIR/llvmIR.mir b/llvm/test/CodeGen/MIR/llvmIR.mir index 4d7fde240c5..3c084ad7d39 100644 --- a/llvm/test/CodeGen/MIR/llvmIR.mir +++ b/llvm/test/CodeGen/MIR/llvmIR.mir @@ -32,4 +32,6 @@ ... --- name: foo +body: + - id: 0 ... diff --git a/llvm/test/CodeGen/MIR/llvmIRMissing.mir b/llvm/test/CodeGen/MIR/llvmIRMissing.mir index 83d846ba44c..80cea5a6fda 100644 --- a/llvm/test/CodeGen/MIR/llvmIRMissing.mir +++ b/llvm/test/CodeGen/MIR/llvmIRMissing.mir @@ -4,4 +4,6 @@ --- # CHECK: name: foo name: foo +body: + - id: 0 ... diff --git a/llvm/test/CodeGen/MIR/machine-function-missing-body-error.mir b/llvm/test/CodeGen/MIR/machine-function-missing-body-error.mir new file mode 100644 index 00000000000..0dc7477f627 --- /dev/null +++ b/llvm/test/CodeGen/MIR/machine-function-missing-body-error.mir @@ -0,0 +1,15 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that the MIR parser reports an error when it encounters a +# machine function with an empty body. + +--- | + + define i32 @foo() { + ret i32 0 + } + +... +--- +# CHECK: machine function 'foo' requires at least one machine basic block in its body +name: foo +... diff --git a/llvm/test/CodeGen/MIR/machine-function-missing-function.mir b/llvm/test/CodeGen/MIR/machine-function-missing-function.mir index eed4142d659..424c34aae84 100644 --- a/llvm/test/CodeGen/MIR/machine-function-missing-function.mir +++ b/llvm/test/CodeGen/MIR/machine-function-missing-function.mir @@ -12,8 +12,12 @@ ... --- name: foo +body: + - id: 0 ... --- # CHECK: function 'faa' isn't defined in the provided LLVM IR name: faa +body: + - id: 0 ... diff --git a/llvm/test/CodeGen/MIR/machine-function-missing-name.mir b/llvm/test/CodeGen/MIR/machine-function-missing-name.mir index b16156e54bd..a868a65d35f 100644 --- a/llvm/test/CodeGen/MIR/machine-function-missing-name.mir +++ b/llvm/test/CodeGen/MIR/machine-function-missing-name.mir @@ -16,7 +16,11 @@ --- # CHECK: [[@LINE+1]]:1: missing required key 'name' nme: foo +body: + - id: 0 ... --- name: bar +body: + - id: 0 ... diff --git a/llvm/test/CodeGen/MIR/machine-function.mir b/llvm/test/CodeGen/MIR/machine-function.mir index 8f053adc22b..afd10ab02c2 100644 --- a/llvm/test/CodeGen/MIR/machine-function.mir +++ b/llvm/test/CodeGen/MIR/machine-function.mir @@ -27,6 +27,8 @@ # CHECK-NEXT: hasInlineAsm: false # CHECK: ... name: foo +body: + - id: 0 ... --- # CHECK: name: bar @@ -35,6 +37,8 @@ name: foo # CHECK-NEXT: hasInlineAsm: false # CHECK: ... name: bar +body: + - id: 0 ... --- # CHECK: name: func @@ -44,6 +48,8 @@ name: bar # CHECK: ... name: func alignment: 8 +body: + - id: 0 ... --- # CHECK: name: func2 @@ -55,4 +61,6 @@ name: func2 alignment: 16 exposesReturnsTwice: true hasInlineAsm: true +body: + - id: 0 ... diff --git a/llvm/test/CodeGen/MIR/register-info.mir b/llvm/test/CodeGen/MIR/register-info.mir index c01997b4685..9585faa9622 100644 --- a/llvm/test/CodeGen/MIR/register-info.mir +++ b/llvm/test/CodeGen/MIR/register-info.mir @@ -22,6 +22,8 @@ # CHECK-NEXT: tracksSubRegLiveness: false # CHECK: ... name: foo +body: + - id: 0 ... --- # CHECK: name: bar @@ -33,4 +35,6 @@ name: bar isSSA: false tracksRegLiveness: true tracksSubRegLiveness: true +body: + - id: 0 ... |