Skip to content

Commit 55b9b11

Browse files
committed
Don't assert about missing profile info in createProfileWeightsForLoop
The compiler shouldn't crash if the profile info is slightly off. We hit this in Chromium. Differential revision: https://reviews.llvm.org/D79417
1 parent 0e6536f commit 55b9b11

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clang/lib/CodeGen/CodeGenPGO.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,7 @@ llvm::MDNode *CodeGenFunction::createProfileWeightsForLoop(const Stmt *Cond,
10511051
if (!PGO.haveRegionCounts())
10521052
return nullptr;
10531053
Optional<uint64_t> CondCount = PGO.getStmtCount(Cond);
1054-
assert(CondCount.hasValue() && "missing expected loop condition count");
1055-
if (*CondCount == 0)
1054+
if (!CondCount || *CondCount == 0)
10561055
return nullptr;
10571056
return createProfileWeights(LoopCount,
10581057
std::max(*CondCount, LoopCount) - LoopCount);

0 commit comments

Comments
 (0)