[PATCH] D79417: Don't assert about missing profile info in createProfileWeightsForLoop
Hans Wennborg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 5 06:58:19 PDT 2020
hans created this revision.
hans added reviewers: thakis, rnk.
The compiler shouldn't crash if the profile info is slightly off. We hit this in Chromium.
https://reviews.llvm.org/D79417
Files:
clang/lib/CodeGen/CodeGenPGO.cpp
Index: clang/lib/CodeGen/CodeGenPGO.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenPGO.cpp
+++ clang/lib/CodeGen/CodeGenPGO.cpp
@@ -1051,8 +1051,7 @@
if (!PGO.haveRegionCounts())
return nullptr;
Optional<uint64_t> CondCount = PGO.getStmtCount(Cond);
- assert(CondCount.hasValue() && "missing expected loop condition count");
- if (*CondCount == 0)
+ if (!CondCount || *CondCount == 0)
return nullptr;
return createProfileWeights(LoopCount,
std::max(*CondCount, LoopCount) - LoopCount);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79417.262096.patch
Type: text/x-patch
Size: 593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200505/2eea589b/attachment.bin>
More information about the cfe-commits
mailing list