summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineVerifier.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-08-27 18:14:26 +0000
committerDan Gohman <gohman@apple.com>2009-08-27 18:14:26 +0000
commita01a80fa6c0c6e9c92ecfa951e974b98c3ba1783 (patch)
tree712044ab6a16b174a79318c2e853f0716c012d7d /lib/CodeGen/MachineVerifier.cpp
parentf83a5def43635436a6c2618e1b0b279d9930ecc7 (diff)
downloadllvm-a01a80fa6c0c6e9c92ecfa951e974b98c3ba1783.tar.gz
llvm-a01a80fa6c0c6e9c92ecfa951e974b98c3ba1783.tar.bz2
llvm-a01a80fa6c0c6e9c92ecfa951e974b98c3ba1783.tar.xz
Adjust the MachineBasicBlock verifier rules to be more
tolerant of blocks that end with "unreachable". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80270 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineVerifier.cpp')
-rw-r--r--lib/CodeGen/MachineVerifier.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/CodeGen/MachineVerifier.cpp b/lib/CodeGen/MachineVerifier.cpp
index a3b5937b29..f43a370345 100644
--- a/lib/CodeGen/MachineVerifier.cpp
+++ b/lib/CodeGen/MachineVerifier.cpp
@@ -312,14 +312,14 @@ MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB)
if (MBB->empty()) {
report("MBB doesn't fall through but is empty!", MBB);
}
- } else {
- // Block falls through.
- if (!MBB->empty() && MBB->back().getDesc().isBarrier()) {
- report("MBB falls through but ends with a barrier instruction!", MBB);
- }
- if (TII->BlockHasNoFallThrough(*MBB)) {
+ }
+ if (TII->BlockHasNoFallThrough(*MBB)) {
+ if (MBB->empty()) {
+ report("TargetInstrInfo says the block has no fall through, but the "
+ "block is empty!", MBB);
+ } else if (!MBB->back().getDesc().isBarrier()) {
report("TargetInstrInfo says the block has no fall through, but the "
- "CFG has a fall-through edge!", MBB);
+ "block does not end in a barrier!", MBB);
}
}
} else {
@@ -341,10 +341,13 @@ MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB)
MachineFunction::const_iterator MBBI = MBB;
++MBBI;
if (MBBI == MF->end()) {
- // TODO: This condition is sometimes reached for functions which
- // make noreturn calls or contain unreachable. Should AnalyzeBranch
- // be changed to handle such cases differently?
- report("MBB falls through out of function!", MBB);
+ // It's possible that the block legitimately ends with a noreturn
+ // call or an unreachable, in which case it won't actually fall
+ // out the bottom of the function.
+ } else if (MBB->succ_empty()) {
+ // It's possible that the block legitimately ends with a noreturn
+ // call or an unreachable, in which case it won't actuall fall
+ // out of the block.
} else if (MBB->succ_size() != 1) {
report("MBB exits via unconditional fall-through but doesn't have "
"exactly one CFG successor!", MBB);