[PATCH] D22141: [BFI] Add option to lazily calculate BFI

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 14:18:41 PDT 2016


anemet added a comment.

> In http://reviews.llvm.org/D22141#478534, @davidxl wrote:

> 

> > I suggest just making BFI lazy itself (when getBlockFreq() is first called ...). In fact  I think the laziness handling should be in BlocFrequencyInfoImpl class. By so doing, MBFI can get the laziness automatically as well.

> 


I've tried and unfortunately, I don't think this will work.  I saw two issues:

a. LoopInfo is freed by the time block frequencies are requested

  This can be fixed by making users of BFI also dependent on LI but that's an overkill for existing users

b. The pass starts modifying the CFG and when it tries to update the frequencies LI and the CFG are already inconsistent

I think that these issues (there maybe more) are difficult to fix in the context of existing BFI's users.  My new proposal is to introduce a new analysis, LazyBFI.  Then, new users could opt in by complying with LBFI's requirements:

1. require LI and BPI as well (I will add an 'required' enumerator)

2. compute BFI before making any CFG changes

The analysis would effectively consist of the LazyBFI class I had earlier.  It will only cover IR BFI for now but we could later template-ize it to also work with BFI.

I talked with Duncan about this and he was fine with this idea.  Let me know your thoughts.

Adam


http://reviews.llvm.org/D22141





More information about the llvm-commits mailing list