[PATCH] D22141: [BFI] Add option to lazily calculate BFI
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 8 15:17:29 PDT 2016
On Fri, Jul 8, 2016 at 3:05 PM, Adam Nemet <anemet at apple.com> wrote:
> anemet added a comment.
> In http://reviews.llvm.org/D22141#478534, @davidxl wrote:
> > There are already too many classes related to BFI, so I am not a fan of
> introducing another LazyBFI.
> > 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.
> Moving it to MBFI, SGTM but I don't think that forcing the calculation of
> the frequencies in getBlockFreq is sufficient.
> So just to be clear, you're suggesting sprinkling around in the code like
> if (!Calculated)
> in getBlockFreq, getBlockProfileCount, setBlockFreq, getFloatingBlockFreq,
> print and printBlockFreq?
getBlockProfileCount will call getBlockFreq, so there is no need to add
setBlockFreq is an incremental update interface. We can assert it is
already calculated so there is no need to add it either.
printBlockFreq calls getFloatingBlockFreq, so there is no need to do check
This leaves only two places:
getBlockFreq and getFloatingBlockFreq. There might be a way to refactor
these two, but I am not too concerned about slight duplication here.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits