[LLVMdev] Some df_iterator and po_iterator issues

Chris Lattner clattner at apple.com
Tue Jul 7 11:45:30 PDT 2009


On Jun 15, 2009, at 4:33 AM, Olaf Krzikalla wrote:
> While trying to eleminate as much std::tr1::function as possible I  
> stumbled over a design flaw in llvm::df_iterator.

Ok.

> However if fn replaces childrens of a just processed statement  
> (which happens a lot), the iteration may crash. Looking at  
> df_iterator reveals the reason: the first child of a particular  
> statement is stored too early for this kind of usage. IMHO this  
> could be fixed by delaying the computation of the first child until  
> it's needed (that is in the preincrement operator). The only open  
> question would be: how do we mark the children iterator invalid  
> before its first use.

This does sound like a useful use-case, but I am uncomfortable with  
making DepthFirstIterator any heavier (by adding "CurrentTopNode" to  
it), is there another way to solve this problem?

> The second one (poi) have to be applied anyway, as it fixes a  
> compile bug rendering po_ext_iterator currently unusable.

Thanks, applied!
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090706/080251.html

-Chris



More information about the llvm-dev mailing list