Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BOLT] Support --show-density for fdata and YAML profiles #110567

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bolt/lib/Passes/BinaryPasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,11 @@ Error PrintProgramStats::runOnFunctions(BinaryContext &BC) {
if (IsHotParentOfBOLTSplitFunction)
for (const BinaryFunction *Fragment : Function.getFragments())
Size += Fragment->getSize();
double Density = (double)1.0 * Function.getSampleCountInBytes() / Size;
uint64_t ExecutedBytes = Function.getSampleCountInBytes();
if (!ExecutedBytes && Function.hasCFG())
for (const BinaryBasicBlock &BB : Function)
ExecutedBytes += BB.getOriginalSize() * BB.getKnownExecutionCount();
double Density = (double)1.0 * ExecutedBytes / Size;
FuncDensityList.emplace_back(Density, SampleCount);
LLVM_DEBUG(BC.outs() << Function << ": executed bytes "
<< Function.getSampleCountInBytes() << ", size (b) "
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.