summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2009-12-11 21:47:36 +0000
committerBill Wendling <isanbard@gmail.com>2009-12-11 21:47:36 +0000
commitc42a0b75a41144be86d40872b57850ab578969ea (patch)
tree8fe3cd7a527c1a561eb0b3822782868d3498bf82 /lib/CodeGen/MachineBasicBlock.cpp
parentd037d7a497caa4d66008723de72fb554ca0ae630 (diff)
downloadllvm-c42a0b75a41144be86d40872b57850ab578969ea.tar.gz
llvm-c42a0b75a41144be86d40872b57850ab578969ea.tar.bz2
llvm-c42a0b75a41144be86d40872b57850ab578969ea.tar.xz
Don't try to move a MBB into the fall-through position if it's a landing pad or
branches only to a landing pad. Without this check, the compiler would go into an infinite loop because the branch to a landing pad is an "abnormal" edge which wasn't being taken into account. This is the meat of that fix: if (!PrevBB.canFallThrough() && !MBB->BranchesToLandingPad(MBB)) { The other stuff is simplification of the "branches to a landing pad" code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91161 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r--lib/CodeGen/MachineBasicBlock.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp
index 0097dd1610..80b4b0ffd8 100644
--- a/lib/CodeGen/MachineBasicBlock.cpp
+++ b/lib/CodeGen/MachineBasicBlock.cpp
@@ -457,16 +457,9 @@ MachineBasicBlock::BranchesToLandingPad(const MachineBasicBlock *MBB) const {
SmallSet<const MachineBasicBlock*, 32> Visited;
const MachineBasicBlock *CurMBB = MBB;
- while (!Visited.count(CurMBB) && !CurMBB->isLandingPad()) {
- if (CurMBB->size() != 1 || CurMBB->succ_empty() || CurMBB->succ_size() != 1)
- break;
-
- const TargetInstrInfo *TII =
- CurMBB->getParent()->getTarget().getInstrInfo();
- if (!TII->isUnpredicatedTerminator(CurMBB->begin()))
- break;
-
- Visited.insert(CurMBB);
+ while (!CurMBB->isLandingPad()) {
+ if (CurMBB->succ_size() != 1) break;
+ if (!Visited.insert(CurMBB)) break;
CurMBB = *CurMBB->succ_begin();
}