diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-06-14 19:30:33 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-06-14 19:30:33 +0000 |
commit | 0fc3015ae8a70152895536ddd8395ce8f6219164 (patch) | |
tree | 69948e01aa7af692992a579e9e6b056794962d36 | |
parent | b8018d8f885f29df3745fa5596bbbfc4c2fa53d2 (diff) | |
download | external_llvm-0fc3015ae8a70152895536ddd8395ce8f6219164.zip external_llvm-0fc3015ae8a70152895536ddd8395ce8f6219164.tar.gz external_llvm-0fc3015ae8a70152895536ddd8395ce8f6219164.tar.bz2 |
Revert r133004 ; it's breaking nightly tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133007 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 161afba..187963c 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1925,7 +1925,7 @@ isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const { return false; // The predecessor has to be immediately before this block. - const MachineBasicBlock *Pred = *PI; + MachineBasicBlock *Pred = *PI; if (!Pred->isLayoutSuccessor(MBB)) return false; @@ -1934,9 +1934,26 @@ isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const { if (Pred->empty()) return true; - // Otherwise, check the last instruction. - const MachineInstr &LastInst = Pred->back(); - return !LastInst.getDesc().isBarrier(); + // Check the terminators in the previous blocks + for (MachineBasicBlock::iterator II = Pred->getFirstTerminator(), + IE = Pred->end(); II != IE; ++II) { + MachineInstr &MI = *II; + + // If it is not a simple branch, we are in a table somewhere. + if (!MI.getDesc().isBranch() || MI.getDesc().isIndirectBranch()) + return false; + + // If we are the operands of one of the branches, this is not + // a fall through. + for (MachineInstr::mop_iterator OI = MI.operands_begin(), + OE = MI.operands_end(); OI != OE; ++OI) { + const MachineOperand& OP = *OI; + if (OP.isMBB() && OP.getMBB() == MBB) + return false; + } + } + + return true; } |