> URL: http://llvm.org/viewvc/llvm-project?rev=41052&view=rev > Log: > Add methods to erase basic block entry. > > + /// removeBlock - Remove basic block BB's frontier. > + void removeBlock(BasicBlock *BB) { > + assert(find(BB) != end() && "Block is not in > DominanceFrontier!"); > + iterator BBDF = Frontiers.find(BB); > + Frontiers.erase(BBDF);
This can just do: Frontiers.erase(BB); > > +/// eraseNode - Removes a node from the domiantor tree. Block > must not domiantor -> dominator > +/// domiante any other blocks. Removes node from its immediate > dominator's domiante -> dominate > +/// children list. Deletes dominator node associated with basic > block BB. > +void DominatorTreeBase::eraseNode(BasicBlock *BB) { Since this can only remove leaf nodes (no children in the domtree) would it make sense to name this eraseLeafNode? > + DomTreeNode *Node = getNode(BB); > + assert (Node && "Removing node that isn't in dominator tree."); > + > + // Remove node from immediate dominator's children list. > + DomTreeNode *IDom = Node->getIDom(); > + if (IDom) { > + std::vector<DomTreeNode*>::iterator I = > + std::find(IDom->Children.begin(), IDom->Children.end(), Node); > + assert(I != IDom->Children.end() && > + "Not in immediate dominator children set!"); > + // I am no longer your child... > + IDom->Children.erase(I); > + } > + > + assert (Node->getChildren().empty() && "Children list is not > empty"); Please move this assertion up to the top, say "Node is not a leaf" or something. Thanks Devang, -Chris _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits