diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index e6e474ed37606..23d3401617316 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -1970,11 +1970,9 @@ static void fixFuncEntryCount(PGOUseFunc &Func, LoopInfo &LI, BranchProbabilityInfo &NBPI) { Function &F = Func.getFunc(); BlockFrequencyInfo NBFI(F, NBPI, LI); -#ifndef NDEBUG auto BFIEntryCount = F.getEntryCount(); - assert(BFIEntryCount && (BFIEntryCount->getCount() > 0) && - "Invalid BFI Entrycount"); -#endif + if (!BFIEntryCount || BFIEntryCount->getCount() == 0) + return; auto SumCount = APFloat::getZero(APFloat::IEEEdouble()); auto SumBFICount = APFloat::getZero(APFloat::IEEEdouble()); for (auto &BBI : F) {