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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299975
91177308-0d34-0410-b5e6-
96231b3b80d8
}
PFS.SM = &SM;
- if (MF.empty())
- return error(Twine("machine function '") + Twine(MF.getName()) +
- "' requires at least one machine basic block in its body");
// Initialize the frame information after creating all the MBBs so that the
// MBB references in the frame information can be resolved.
if (initializeFrameInfo(PFS, YamlMF))
lastIndex = SlotIndex();
regsReserved = MRI->getReservedRegs();
- markReachable(&MF->front());
+ if (!MF->empty())
+ markReachable(&MF->front());
// Build a set of the basic blocks in the function.
FunctionBlocks.clear();
// Check that the register use lists are sane.
MRI->verifyUseLists();
- verifyStackFrame();
+ if (!MF->empty())
+ verifyStackFrame();
}
// Does iterator point to a and b as the first two elements?
IfUnequal:
ret i32 0
}
-
+
...
---
name: foo
-body: |
- bb.0:
...
---
# CHECK: name: foo
name: foo
-body: |
- bb.0:
...
+++ /dev/null
-# 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
-...
--- /dev/null
+# 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
+...
...
---
name: foo
-body: |
- bb.0:
...
---
# CHECK: function 'faa' isn't defined in the provided LLVM IR
name: faa
-body: |
- bb.0:
...
---
# CHECK: [[@LINE+1]]:1: missing required key 'name'
nme: foo
-body: |
- bb.0:
...
---
name: bar
-body: |
- bb.0:
...
define i32 @func2() {
ret i32 0
}
-
+
...
---
# CHECK: name: foo
# CHECK-NEXT: exposesReturnsTwice: false
# CHECK: ...
name: foo
-body: |
- bb.0:
...
---
# CHECK: name: bar
# CHECK-NEXT: exposesReturnsTwice: false
# CHECK: ...
name: bar
-body: |
- bb.0:
...
---
# CHECK: name: func
# CHECK: ...
name: func
alignment: 8
-body: |
- bb.0:
...
---
# CHECK: name: func2
name: func2
alignment: 16
exposesReturnsTwice: true
-body: |
- bb.0:
...
# CHECK: tracksRegLiveness: false
# CHECK: ...
name: foo
-body: |
- bb.0:
...
---
# CHECK: name: bar
# CHECK: ...
name: bar
tracksRegLiveness: true
-body: |
- bb.0:
...