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

Chris Lattner clattner at apple.com
Fri Jun 8 10:47:25 PDT 2007


> --- 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.  Also, "domiantor" is misspelled in the comment,

-Chris




More information about the llvm-commits mailing list