MIR: Allow parsing of empty machine functions

If you run llc -stop-after=codegenprepare and feed the resulting MIR
to llc -start-after=codegenprepare, you'll have an empty machine
function since we haven't run any isel yet. Of course, this only works
if the MIRParser believes you that this is okay.

This is essentially a revert of r241862 with a fix for the problem it
was papering over.

llvm-svn: 299975
diff --git a/llvm/test/CodeGen/MIR/Generic/llvmIR.mir b/llvm/test/CodeGen/MIR/Generic/llvmIR.mir
index 432b18f..5c0e60e 100644
--- a/llvm/test/CodeGen/MIR/Generic/llvmIR.mir
+++ b/llvm/test/CodeGen/MIR/Generic/llvmIR.mir
@@ -28,10 +28,8 @@
   IfUnequal:
     ret i32 0
   }
-  
+
 ...
 ---
 name: foo
-body: |
-  bb.0:
 ...
diff --git a/llvm/test/CodeGen/MIR/Generic/llvmIRMissing.mir b/llvm/test/CodeGen/MIR/Generic/llvmIRMissing.mir
index 9bd2a3e..419f60b 100644
--- a/llvm/test/CodeGen/MIR/Generic/llvmIRMissing.mir
+++ b/llvm/test/CodeGen/MIR/Generic/llvmIRMissing.mir
@@ -4,6 +4,4 @@
 ---
 # CHECK: name: foo
 name: foo
-body: |
-  bb.0:
 ...
diff --git a/llvm/test/CodeGen/MIR/Generic/machine-function-missing-body-error.mir b/llvm/test/CodeGen/MIR/Generic/machine-function-missing-body-error.mir
deleted file mode 100644
index 1896371..0000000
--- a/llvm/test/CodeGen/MIR/Generic/machine-function-missing-body-error.mir
+++ /dev/null
@@ -1,15 +0,0 @@
-# RUN: not llc -run-pass none -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/Generic/machine-function-missing-body.mir b/llvm/test/CodeGen/MIR/Generic/machine-function-missing-body.mir
new file mode 100644
index 0000000..0fd970c
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/machine-function-missing-body.mir
@@ -0,0 +1,15 @@
+# RUN: llc -run-pass none -o - %s | FileCheck %s
+# This test ensures that the MIR parser accepts files with llvm IR but
+# no machine function body.
+
+--- |
+  ; CHECK: define i32 @foo()
+  define i32 @foo() {
+    ret i32 0
+  }
+
+...
+---
+# CHECK: name: foo
+name:            foo
+...
diff --git a/llvm/test/CodeGen/MIR/Generic/machine-function-missing-function.mir b/llvm/test/CodeGen/MIR/Generic/machine-function-missing-function.mir
index c547bb2..b218afd 100644
--- a/llvm/test/CodeGen/MIR/Generic/machine-function-missing-function.mir
+++ b/llvm/test/CodeGen/MIR/Generic/machine-function-missing-function.mir
@@ -12,12 +12,8 @@
 ...
 ---
 name:            foo
-body: |
-  bb.0:
 ...
 ---
 # CHECK: function 'faa' isn't defined in the provided LLVM IR
 name:            faa
-body: |
-  bb.0:
 ...
diff --git a/llvm/test/CodeGen/MIR/Generic/machine-function-missing-name.mir b/llvm/test/CodeGen/MIR/Generic/machine-function-missing-name.mir
index 30f0e51..bc279a6 100644
--- a/llvm/test/CodeGen/MIR/Generic/machine-function-missing-name.mir
+++ b/llvm/test/CodeGen/MIR/Generic/machine-function-missing-name.mir
@@ -16,11 +16,7 @@
 ---
 # CHECK: [[@LINE+1]]:1: missing required key 'name'
 nme:             foo
-body: |
-  bb.0:
 ...
 ---
 name:            bar
-body: |
-  bb.0:
 ...
diff --git a/llvm/test/CodeGen/MIR/Generic/machine-function.mir b/llvm/test/CodeGen/MIR/Generic/machine-function.mir
index f9001cc..9c19b98 100644
--- a/llvm/test/CodeGen/MIR/Generic/machine-function.mir
+++ b/llvm/test/CodeGen/MIR/Generic/machine-function.mir
@@ -18,7 +18,7 @@
   define i32 @func2() {
     ret i32 0
   }
-  
+
 ...
 ---
 # CHECK: name: foo
@@ -26,8 +26,6 @@
 # CHECK-NEXT: exposesReturnsTwice: false
 # CHECK: ...
 name:            foo
-body: |
-  bb.0:
 ...
 ---
 # CHECK: name: bar
@@ -35,8 +33,6 @@
 # CHECK-NEXT: exposesReturnsTwice: false
 # CHECK: ...
 name:            bar
-body: |
-  bb.0:
 ...
 ---
 # CHECK: name: func
@@ -45,8 +41,6 @@
 # CHECK: ...
 name:            func
 alignment:       8
-body: |
-  bb.0:
 ...
 ---
 # CHECK: name: func2
@@ -56,6 +50,4 @@
 name:            func2
 alignment:       16
 exposesReturnsTwice: true
-body: |
-  bb.0:
 ...
diff --git a/llvm/test/CodeGen/MIR/Generic/register-info.mir b/llvm/test/CodeGen/MIR/Generic/register-info.mir
index af3f44f..84a6125 100644
--- a/llvm/test/CodeGen/MIR/Generic/register-info.mir
+++ b/llvm/test/CodeGen/MIR/Generic/register-info.mir
@@ -20,8 +20,6 @@
 # CHECK: tracksRegLiveness: false
 # CHECK: ...
 name:            foo
-body: |
-  bb.0:
 ...
 ---
 # CHECK: name: bar
@@ -29,6 +27,4 @@
 # CHECK: ...
 name: bar
 tracksRegLiveness: true
-body: |
-  bb.0:
 ...