diff --git a/bolt/BinaryFunctionProfile.cpp b/bolt/BinaryFunctionProfile.cpp index 78ce9444c3a6..c341faa72b11 100644 --- a/bolt/BinaryFunctionProfile.cpp +++ b/bolt/BinaryFunctionProfile.cpp @@ -366,8 +366,10 @@ void BinaryFunction::postProcessProfile() { for (auto *BB : BasicBlocks) { auto SuccBIIter = BB->branch_info_begin(); for (auto Succ : BB->successors()) { - if (!Succ->isEntryPoint() && - SuccBIIter->Count != BinaryBasicBlock::COUNT_NO_PROFILE) + // All incoming edges to the primary entry have been accounted for, thus + // we skip the update here. + if (SuccBIIter->Count != BinaryBasicBlock::COUNT_NO_PROFILE && + Succ != BasicBlocks.front()) Succ->setExecutionCount(Succ->getExecutionCount() + SuccBIIter->Count); ++SuccBIIter; }