Fix an iterator invalidation bug I induced.
authorChris Lattner <sabre@nondot.org>
Sun, 5 Aug 2007 00:24:30 +0000 (00:24 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 5 Aug 2007 00:24:30 +0000 (00:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40830 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/PostDominators.cpp
lib/VMCore/Dominators.cpp

index d2892de8ed2429622a930271e3b959f9d1856389..4622441e06b4843dc0eba8d8dad046c9606e31f6 100644 (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
   // IDomNode
   DomTreeNode *C = new DomTreeNode(BB, IPDomNode);
-  DomTreeNodes[BB] = C;
-  return BBNode = IPDomNode->addChild(C);
+  return DomTreeNodes[BB] = IPDomNode->addChild(C);
 }
 
 //===----------------------------------------------------------------------===//
index 7d0fbaa29aa5e656f6bca56981c68930c2ed573f..8981ee70b09dce31a73e9644d494e84922c84606 100644 (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;
   unsigned i = 0;
   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
   // IDomNode
   DomTreeNode *C = new DomTreeNode(BB, IDomNode);
-  DomTreeNodes[BB] = C;
-  return BBNode = IDomNode->addChild(C);
+  return DomTreeNodes[BB] = IDomNode->addChild(C);
 }
 
 static std::ostream &operator<<(std::ostream &o,