[llvm-commits] [llvm] r80270 - /llvm/trunk/lib/CodeGen/MachineVerifier.cpp
Dan Gohman
gohman at apple.com
Thu Aug 27 11:14:27 PDT 2009
Author: djg
Date: Thu Aug 27 13:14:26 2009
New Revision: 80270
URL: http://llvm.org/viewvc/llvm-project?rev=80270&view=rev
Log:
Adjust the MachineBasicBlock verifier rules to be more
tolerant of blocks that end with "unreachable".
Modified:
llvm/trunk/lib/CodeGen/MachineVerifier.cpp
Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineVerifier.cpp?rev=80270&r1=80269&r2=80270&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Thu Aug 27 13:14:26 2009
@@ -312,14 +312,14 @@
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 @@
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);
More information about the llvm-commits
mailing list