mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
MIR Parser: report an error when a basic block isn't found.
This commit reports an error when the MIR parser can't find a basic block with the machine basic block's name. llvm-svn: 240174
This commit is contained in:
parent
4f7f317571
commit
b907fa377d
@ -212,7 +212,9 @@ bool MIRParserImpl::initializeMachineFunction(MachineFunction &MF) {
|
||||
if (!YamlMBB.Name.empty()) {
|
||||
BB = dyn_cast_or_null<BasicBlock>(
|
||||
F.getValueSymbolTable().lookup(YamlMBB.Name));
|
||||
// TODO: Report an error if a basic block isn't found.
|
||||
if (!BB)
|
||||
return error(Twine("basic block '") + YamlMBB.Name +
|
||||
"' is not defined in the function '" + MF.getName() + "'");
|
||||
}
|
||||
auto *MBB = MF.CreateMachineBasicBlock(BB);
|
||||
MF.insert(MF.end(), MBB);
|
||||
|
18
test/CodeGen/MIR/machine-basic-block-unknown-name.mir
Normal file
18
test/CodeGen/MIR/machine-basic-block-unknown-name.mir
Normal file
@ -0,0 +1,18 @@
|
||||
# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s
|
||||
# This test ensures that an error is reported whenever the MIR parser can't find
|
||||
# a basic block with the machine basis block's name.
|
||||
|
||||
--- |
|
||||
|
||||
define i32 @foo() {
|
||||
entry:
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
...
|
||||
---
|
||||
name: foo
|
||||
body:
|
||||
# CHECK: basic block 'entrie' is not defined in the function 'foo'
|
||||
- name: entrie
|
||||
...
|
Loading…
Reference in New Issue
Block a user