Author: Hans Wennborg Date: 2020-05-05T18:59:00+02:00 New Revision: 55b9b11fea3e18b6826c39842bc43877d9eb57fd
URL: https://github.com/llvm/llvm-project/commit/55b9b11fea3e18b6826c39842bc43877d9eb57fd DIFF: https://github.com/llvm/llvm-project/commit/55b9b11fea3e18b6826c39842bc43877d9eb57fd.diff LOG: 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 Added: Modified: clang/lib/CodeGen/CodeGenPGO.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp index bad796bf92dc..3c91a04d5464 100644 --- a/clang/lib/CodeGen/CodeGenPGO.cpp +++ b/clang/lib/CodeGen/CodeGenPGO.cpp @@ -1051,8 +1051,7 @@ llvm::MDNode *CodeGenFunction::createProfileWeightsForLoop(const Stmt *Cond, 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); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits