[PATCH] D16381: Infrastructure to allow use of PGO in inliner
Easwaran Raman via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 2 16:18:06 PST 2016
eraman added inline comments.
================
Comment at: lib/Analysis/InlineCost.cpp:1564
@@ +1563,3 @@
+ uint64_t FunctionEntryFreq = BFI->getEntryFreq();
+ uint64_t BBCount = EntryCount.getValue() * BBFreq / FunctionEntryFreq;
+ return BBCount;
----------------
junbuml wrote:
> Can we guarantee FunctionEntryFreq is always non-zero if EntryCount is non-zero ?
FunctionEntryFreq is always non-zero and that doesn't depend on entry count.
================
Comment at: lib/Transforms/IPO/InlineSimple.cpp:159
@@ +158,3 @@
+ BlockFrequency OrigBBFreq = CalleeBFI->getBlockFreq(OrigBB);
+ CallerBFI->setBlockFreq(NewBB, (double)(OrigBBFreq.getFrequency()) /
+ CalleeEntryFreq * CallSiteFreq);
----------------
junbuml wrote:
> Should we have (double) here ?
Not sure why that is needed.
================
Comment at: lib/Transforms/IPO/InlineSimple.cpp:160
@@ +159,3 @@
+ CallerBFI->setBlockFreq(NewBB, (double)(OrigBBFreq.getFrequency()) /
+ CalleeEntryFreq * CallSiteFreq);
+}
----------------
junbuml wrote:
> why not checking CalleeEntryFreq * CallSiteFreq is non-zero.
It is dividing by CalleeEntryFreq and multiplying by CallSiteFreq, so this is a problem only when CalleeEntryFreq is 0. As I wrote in a previous comment, that is not possible.
http://reviews.llvm.org/D16381
More information about the llvm-commits
mailing list