[PATCH] D121655: [llvm-profgen] Read sample profiles for post-processing.
Hongtao Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 25 12:55:17 PDT 2022
hoy added inline comments.
================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:423-427
+ // This is for the case the input is a llvm sample profile.
+ for (const auto &FS : ProfileMap) {
+ if (auto *Func = Binary->getBinaryFunction(FS.first.getName()))
+ ProfiledFunctions.insert(Func);
+ }
----------------
wenlei wrote:
> So for pgo profile as input, we still need probe decoding because preinliner needs context size based on profile, right?
Exactly.
================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.h:135-137
+ const ContextSampleCounterMap &&Counters)
+ : ProfileGeneratorBase(Binary, std::move(Counters)){};
+ ProfileGenerator(ProfiledBinary *Binary, const SampleProfileMap &&Profiles)
----------------
wenlei wrote:
> Both `Reader->getSampleCounters()` and `Reader->getProfiles()` return by reference so there should be no copy, why do we need move ctor here?
This is because previously the `SampleCounters` field is a reference and it must be initialized in constructors. I'm now changing it to a value field and using the move constructor to initialize it when needed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121655/new/
https://reviews.llvm.org/D121655
More information about the llvm-commits
mailing list