diff --git a/bolt/include/bolt/Core/BinaryFunction.h b/bolt/include/bolt/Core/BinaryFunction.h --- a/bolt/include/bolt/Core/BinaryFunction.h +++ b/bolt/include/bolt/Core/BinaryFunction.h @@ -1868,6 +1868,10 @@ /// executions corresponding to this function. uint64_t getRawBranchCount() const { return RawBranchCount; } + /// Set the profile data about the number of branch executions corresponding + /// to this function. + void setRawBranchCount(uint64_t Count) { RawBranchCount = Count; } + /// Return the execution count for functions with known profile. /// Return 0 if the function has no profile. uint64_t getKnownExecutionCount() const { diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp --- a/bolt/lib/Core/BinaryFunction.cpp +++ b/bolt/lib/Core/BinaryFunction.cpp @@ -471,6 +471,7 @@ if (ExecutionCount != COUNT_NO_PROFILE) { OS << "\n Exec Count : " << ExecutionCount; OS << "\n Profile Acc : " << format("%.1f%%", ProfileMatchRatio * 100.0f); + OS << "\n RawBranchCount : " << RawBranchCount; } if (opts::PrintDynoStats && !getLayout().block_empty()) { diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp --- a/bolt/lib/Profile/YAMLProfileReader.cpp +++ b/bolt/lib/Profile/YAMLProfileReader.cpp @@ -83,6 +83,14 @@ BF.setExecutionCount(YamlBF.ExecCount); + uint64_t FuncRawBranchCount = 0; + for (const yaml::bolt::BinaryBasicBlockProfile &YamlBB : YamlBF.Blocks) { + for (const yaml::bolt::SuccessorInfo &YamlSI : YamlBB.Successors) { + FuncRawBranchCount += YamlSI.Count; + } + } + BF.setRawBranchCount(FuncRawBranchCount); + if (!opts::IgnoreHash && YamlBF.Hash != BF.computeHash(/*UseDFS=*/true)) { if (opts::Verbosity >= 1) errs() << "BOLT-WARNING: function hash mismatch\n";