[llvm-commits] [patch] Loop Iterators

Andrew Trick atrick at apple.com
Mon Aug 1 23:22:02 PDT 2011


On Aug 1, 2011, at 11:10 PM, Jakub Staszak wrote:

> Hi Andy,
> 
> I don't fully understand why you reserve PostNumbers with NextPowerOf2 size and PostBlocks with numBlocks.

It's good to avoid dynamic reallocation when you have predetermined number of elts. PostBlocks is a std::vector--reserve the exact number. PostNumbers is a DenseMap. I'm not sure the best hash map size for my number of elts, so I just do exactly what the DenseMap constructor does. DenseMap clearly doesn't have a good interface for this, but I didn't think it was a big deal.

-Andy

> On Aug 1, 2011, at 10:35 PM, Andrew Trick wrote:
> 
>> This patch provides a new interface for iterating over a loop's blocks in DFS order. I currently need this for the LoopInfo updater that I'll send in the next patch. I think something like this is fairly important for efficient DFS based CFG analysis, so I want a general interface. But it's not quite important enough for a new pass. Updating LoopInfo only occasionally needs to perform DFS on the loop body. For example, when loop unswitching results in a never reached backedge, or unrolling completely unrolls a loop.
>> 
>> <loopiter.patch>_______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 




More information about the llvm-commits mailing list