diff options
author | Bill Wendling <isanbard@gmail.com> | 2009-12-11 21:47:36 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2009-12-11 21:47:36 +0000 |
commit | b87b9925bed5bc185a216806b80988c8f203ff8e (patch) | |
tree | 1783e636404666dd13535b2b4584f70c439e596f /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | b314bd688a69285e4186f78ee613ec4267426a7a (diff) | |
download | bcm5719-llvm-b87b9925bed5bc185a216806b80988c8f203ff8e.tar.gz bcm5719-llvm-b87b9925bed5bc185a216806b80988c8f203ff8e.zip |
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.
llvm-svn: 91161
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 0097dd16105..80b4b0ffd8d 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/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(); } |