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

Devang Patel dpatel at apple.com
Fri Jun 8 10:54:03 PDT 2007


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




More information about the llvm-commits mailing list