From 08916cef7e7ae334a04769126c2fefc144f8a5a0 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Thu, 24 Oct 2024 18:28:44 -0700 Subject: [PATCH] [BOLT] Set RawBranchCount in DataAggregator Align DataAggregator (Linux perf and pre-aggregated profile reader) to DataReader (fdata profile reader) behavior: set BF->RawBranchCount which is used in profile density computation (#101094). Reviewers: ayermolo, maksfb, dcci, rafaelauler, WenleiHe Reviewed By: WenleiHe Pull Request: https://github.com/llvm/llvm-project/pull/101093 --- bolt/lib/Profile/DataAggregator.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp index 0a63148379d900..2e83ca03dbde6b 100644 --- a/bolt/lib/Profile/DataAggregator.cpp +++ b/bolt/lib/Profile/DataAggregator.cpp @@ -638,8 +638,12 @@ void DataAggregator::processProfile(BinaryContext &BC) { : BinaryFunction::PF_LBR; for (auto &BFI : BC.getBinaryFunctions()) { BinaryFunction &BF = BFI.second; - if (getBranchData(BF) || getFuncSampleData(BF.getNames())) + FuncBranchData *FBD = getBranchData(BF); + if (FBD || getFuncSampleData(BF.getNames())) { BF.markProfiled(Flags); + if (FBD) + BF.RawBranchCount = FBD->getNumExecutedBranches(); + } } for (auto &FuncBranches : NamesToBranches)