[PATCH] D28535: Scale frequencies of a set of blocks

Easwaran Raman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 10 16:53:22 PST 2017


eraman marked an inline comment as done.
eraman added inline comments.


================
Comment at: lib/Analysis/BlockFrequencyInfo.cpp:183
+
+    APInt BBFreq(128, BFI->getBlockFreq(BB).getFrequency());
+
----------------
chandlerc wrote:
> This does 2+N heap allocations where N is the number of basic blocks passed in.... Can we do something more efficient?
> 
> Can we use some of the other scaling infrastructure that is already used in BFI such as ScaledNumber?
> 
> At the very least, please don't declare a new APInt inside the loop.
I can't think of a good way to efficiently do this with ScaledNumber.

I have moved BBFreq declaration out of the loop. Now, there is a call to = operator inside the loop which calls a memset. If the right set of optimizations kick in this memset should reduce to a store.  Does this look reasonable?


https://reviews.llvm.org/D28535





More information about the llvm-commits mailing list