Use a SmallPtrSet to dedup successors in EmitSjLjDispatchBlock.

The test case ARM/2011-05-04-MultipleLandingPadSuccs.ll was creating
duplicate successor list entries.

llvm-svn: 162222
This commit is contained in:
Jakob Stoklund Olesen 2012-08-20 20:52:03 +00:00
parent bda04301d4
commit 710093e360
1 changed files with 2 additions and 3 deletions

View File

@ -6151,13 +6151,12 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const {
}
// Add the jump table entries as successors to the MBB.
MachineBasicBlock *PrevMBB = 0;
SmallPtrSet<MachineBasicBlock*, 8> SeenMBBs;
for (std::vector<MachineBasicBlock*>::iterator
I = LPadList.begin(), E = LPadList.end(); I != E; ++I) {
MachineBasicBlock *CurMBB = *I;
if (PrevMBB != CurMBB)
if (SeenMBBs.insert(CurMBB))
DispContBB->addSuccessor(CurMBB);
PrevMBB = CurMBB;
}
// N.B. the order the invoke BBs are processed in doesn't matter here.