[PATCH] D111750: [llvm-profgen] Allow unsymbolized profile as perf input
Lei Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 22 11:27:23 PDT 2021
wlei added inline comments.
================
Comment at: llvm/tools/llvm-profgen/PerfReader.cpp:788-789
+ while (!TraceIt.isAtEoF()) {
+ std::shared_ptr<StringBasedCtxKey> Key =
+ std::make_shared<StringBasedCtxKey>();
+ StringRef Line = TraceIt.getCurrentLine();
----------------
wenlei wrote:
> The underlying object created by make_shared stays on heap, but SampleCounters.emplace creates another copy of the object? is that intentional or did I miss anything?
(Seems phabricator lost my comments..)
`SampleCounters` key is a `Hashable<ContextKey>` type.
My understanding is `emplace` will call the ctor of `Hashable`, it's like:
```
template <class T> class Hashable {
public:
std::shared_ptr<T> Data;
Hashable(const std::shared_ptr<T> &D) : Data(D) {}
...
```
`Hashable` only own the shared_ptr, do not own the underlying object, so it should only copy the shared_ptr.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111750/new/
https://reviews.llvm.org/D111750
More information about the llvm-commits
mailing list