aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-06-14 18:12:31 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-06-14 18:12:31 +0000
commitb8018d8f885f29df3745fa5596bbbfc4c2fa53d2 (patch)
tree13b31897c4eceb9f9e954c14a9db5b60f259e257 /lib/CodeGen/AsmPrinter
parenta6eb2562b62fc293295f2fede2608753563e7005 (diff)
Partial revert of 132882.
Dan noted that this would work on the case shown on the commit message. I think the case that was failing was a bb ending with a redundant conditional jump: ... jne foo foo: ... I was unable to find any such case in the tests or in a debug build of clang, so I will revert this part of the patch and watch the bots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133004 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp25
1 files changed, 4 insertions, 21 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 187963c26a..161afbafb5 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.
- MachineBasicBlock *Pred = *PI;
+ const MachineBasicBlock *Pred = *PI;
if (!Pred->isLayoutSuccessor(MBB))
return false;
@@ -1934,26 +1934,9 @@ isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const {
if (Pred->empty())
return true;
- // 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;
+ // Otherwise, check the last instruction.
+ const MachineInstr &LastInst = Pred->back();
+ return !LastInst.getDesc().isBarrier();
}