[llvm] [PGO] Gracefully handle zero entry-count in `fixFuncEntryCount` (PR #112029)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 12:41:34 PDT 2024


================
@@ -1972,11 +1972,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)
----------------
WenleiHe wrote:

Can we bypass the assertion only for sampled IRPGO? 

https://github.com/llvm/llvm-project/pull/112029


More information about the llvm-commits mailing list