[PATCH] D95547: [CSSPGO] Support of CS profiles in extended binary format.
Lei Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 27 14:05:52 PST 2021
wlei added inline comments.
================
Comment at: llvm/lib/ProfileData/SampleProfWriter.cpp:150
uint64_t Offset = OutputStream->tell();
- StringRef Name = S.getName();
+ StringRef Name = S.getInputNameWithContext();
FuncOffsetTable[Name] = Offset - SecLBRProfileStart;
----------------
hoy wrote:
> wenlei wrote:
> > If we keep StringRef for context with bracket, we can use it for text profile writer as well.
> >
> > As we discussed off patch, the context provided by llvm-profgen may not have [], and it's probably better to fix that to make it consistent.
> Exactly. The text writer for now has to emit the brackets explicitly like below. @wlei this can be fixed by including brackets in the final context string during profile generation.
>
>
> ```
> std::error_code SampleProfileWriterText::writeSample(const FunctionSamples &S) {
> auto &OS = *OutputStream;
> if (FunctionSamples::ProfileIsCS)
> OS << "[" << S.getNameWithContext() << "]:" << S.getTotalSamples();
> else
> OS << S.getName() << ":" << S.getTotalSamples();
> ```
Got it! So I will fix like the code below:
```
if (FunctionSamples::ProfileIsCS)
OS << S.getNameWithContext() << S.getTotalSamples();
else
OS << S.getName() << ":" << S.getTotalSamples();
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95547/new/
https://reviews.llvm.org/D95547
More information about the llvm-commits
mailing list