On Jun 8, 2007, at 10:47 AM, Chris Lattner wrote: >> --- llvm/include/llvm/Analysis/Dominators.h:1.95 Thu Jun 7 >> 16:34:22 2007 >> +++ llvm/include/llvm/Analysis/Dominators.h Thu Jun 7 17:17:16 2007 >> @@ -142,6 +142,16 @@ >> return getNode(BB); >> } >> >> + /// getIDomBlock - return basic block BB's immediate domiantor >> basic block. >> + /// >> + BasicBlock *getIDomBlock(BasicBlock *BB) { >> + DomTreeNode *N = getNode(BB); >> + assert (N && "Missing dominator tree node"); >> + DomTreeNode *I = N->getIDom(); >> + assert (N && "Missing immediate dominator"); >> + return I->getBlock(); >> + } > > This will assert and die if called on the entry node, because it has > no idom. Would it make sense to have this function return null in > this case? If so, please document it as returning null in that > case.
Current clients do not expect null here. > Also, "domiantor" is misspelled in the comment, oops - Devang _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits