[PATCH] D17212: [ThinLTO] Support for call graph in per-module and combined summary.

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 07:25:18 PST 2016

tejohnson added a comment.

Response to eraman's comment.

Comment at: include/llvm/ProfileData/ProfileCommon.h:98
@@ +97,3 @@
+  auto ScaledCount = BlockFrequency(EntryCount);
+  if (EntryFreq > UINT32_MAX || BlockFreq > UINT32_MAX)
+    // Can't use BranchProbability in general, since it takes 32-bit numbers.
eraman wrote:
> Why not just do
> ScaledCount = EntryCount * BlockFreq / EntryFreq using APInt<128>, take the lower 64 bits if the result fitx within uint64_t and use UINT64_MAX otheerwise?
I looked at APInt briefly when I was thinking about how to do this, but was concerned that it was going to be inefficient in the common case. However, it looks like that isn't the case as it has a fast path. Will change this to use it.

Note I actually stole this code from RAGreedy::initializeCSRCost() (which could probably be refactored to use this new method once it goes in).


More information about the llvm-commits mailing list