[PATCH] D22744: CodeExtractor : Add ability to preserve profile data.
David Li via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 27 09:54:19 PDT 2016
davidxl added inline comments.
================
Comment at: lib/Transforms/Utils/CodeExtractor.cpp:693
@@ +692,3 @@
+ for (auto &Weight : ExitWeights) {
+ if (Weight.second.getFrequency() == 0) {
+ HasValidWeights = false;
----------------
This check does not look correct. It is possible for the frequency to be zero
================
Comment at: lib/Transforms/Utils/CodeExtractor.cpp:805
@@ +804,3 @@
+ // Update the entry count of the function.
+ if (BFI && EntryFreq.getFrequency() > 0) {
+ Optional<uint64_t> OptEntryCount =
----------------
The Freq > 0 check can be removed. I don't see how it can be zero (it is not actual count).
================
Comment at: lib/Transforms/Utils/CodeExtractor.cpp:808
@@ +807,3 @@
+ BFI->getProfileCountFromFreq(EntryFreq.getFrequency());
+ newFunction->setEntryCount( OptEntryCount.getValue());
+ BFI->setBlockFreq(codeReplacer, EntryFreq.getFrequency());
----------------
silvas wrote:
> nit: no space after the open paren
The check should be here: if optEntryCount has value (hasValue() returns true, not >0), set it to the newFunction entry. hasValue is false when PGO is not enabled.
https://reviews.llvm.org/D22744
More information about the llvm-commits
mailing list