[llvm-commits] BlockFrequency for BasicBlocks

Andrew Trick atrick at apple.com
Fri Jun 17 16:10:49 PDT 2011


On Jun 17, 2011, at 2:16 PM, Jakub Staszak wrote:

> The new version attached.
> 
> Thanks!
> - Kuba
> <bf4bb.3.patch>
> On Jun 17, 2011, at 1:41 PM, Chris Lattner wrote:
> 
>> 
>> On Jun 17, 2011, at 12:20 PM, Jakub Staszak wrote:
>> 
>>> Hi,
>>> 
>>> This patch introduces BlockFrequency analysis for BasicBlocks. OK to commit? 
>>> Comments are welcome!

Hi Kuba,

If you define the constructor and destructor in the .cpp, then do you still need to include InitializePasses.h from BlockFrequency.h. And do you really need a "deinit" method?

The block frequency pass should only require a *single* CFG graph traversal. I'm not sure how to do that with LLVM's current rpot/pot iterators. Ideally, LLVM would have a DFSOrder analysis to order the blocks. That ordering will remain valid until some CFG transform.

For, now I think you can at least limit it to two traversals (one reverse postorder and one postorder) and add a FIXME so we remember to fold it into one traversal later. Subsequently whenever you need to visit blocks in RPO/PO order, just use the RPO/PO vectors directly.

Can you also comment that LoopSimplify can make the algorithm converge faster.

Can frequency reach zero in divBlockFreq? Don't you want to saturate at 1?

-Andy



More information about the llvm-commits mailing list