Fix an iterator invalidation bug I induced.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40830 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-08-05 00:24:30 +00:00
parent 2f0d1ea864
commit a31965301d
2 changed files with 4 additions and 5 deletions

View File

@ -217,8 +217,7 @@ DomTreeNode *PostDominatorTree::getNodeForBlock(BasicBlock *BB) {
// Add a new tree node for this BasicBlock, and link it as a child of // Add a new tree node for this BasicBlock, and link it as a child of
// IDomNode // IDomNode
DomTreeNode *C = new DomTreeNode(BB, IPDomNode); DomTreeNode *C = new DomTreeNode(BB, IPDomNode);
DomTreeNodes[BB] = C; return DomTreeNodes[BB] = IPDomNode->addChild(C);
return BBNode = IPDomNode->addChild(C);
} }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//

View File

@ -120,7 +120,8 @@ void DominatorTree::splitBlock(BasicBlock *NewBB) {
} }
// Find NewBB's immediate dominator and create new dominator tree node for NewBB. // Find NewBB's immediate dominator and create new dominator tree node for
// NewBB.
BasicBlock *NewBBIDom = 0; BasicBlock *NewBBIDom = 0;
unsigned i = 0; unsigned i = 0;
for (i = 0; i < PredBlocks.size(); ++i) for (i = 0; i < PredBlocks.size(); ++i)
@ -552,8 +553,7 @@ DomTreeNode *DominatorTree::getNodeForBlock(BasicBlock *BB) {
// Add a new tree node for this BasicBlock, and link it as a child of // Add a new tree node for this BasicBlock, and link it as a child of
// IDomNode // IDomNode
DomTreeNode *C = new DomTreeNode(BB, IDomNode); DomTreeNode *C = new DomTreeNode(BB, IDomNode);
DomTreeNodes[BB] = C; return DomTreeNodes[BB] = IDomNode->addChild(C);
return BBNode = IDomNode->addChild(C);
} }
static std::ostream &operator<<(std::ostream &o, static std::ostream &operator<<(std::ostream &o,