[llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h

Chris Lattner clattner at apple.com
Fri Jun 8 11:00:21 PDT 2007


>>> +  /// 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.

I assume that current clients never call this on an entry block. If  
they did it would assert :).

I'm just saying that would be the behavior I would expect if calling  
this from a new client.

-Chris




More information about the llvm-commits mailing list