From: Dehao Chen Date: Fri, 10 Mar 2017 01:44:37 +0000 (+0000) Subject: Do not use branch metadata to check if a basic block is hot. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e7c1260471d1832f4281c9a435edac8f16b16631;p=llvm Do not use branch metadata to check if a basic block is hot. Summary: We should not use that to check basic block hotness as optimization may mess it up. Reviewers: eraman Reviewed By: eraman Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30800 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297437 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/ProfileSummaryInfo.cpp b/lib/Analysis/ProfileSummaryInfo.cpp index 5ca18303338..623c9fac52a 100644 --- a/lib/Analysis/ProfileSummaryInfo.cpp +++ b/lib/Analysis/ProfileSummaryInfo.cpp @@ -124,18 +124,7 @@ bool ProfileSummaryInfo::isColdCount(uint64_t C) { bool ProfileSummaryInfo::isHotBB(const BasicBlock *B, BlockFrequencyInfo *BFI) { auto Count = BFI->getBlockProfileCount(B); - if (Count && isHotCount(*Count)) - return true; - // Use extractProfTotalWeight to get BB count. - // For Sample PGO, BFI may not provide accurate BB count due to errors - // magnified during sample count propagation. This serves as a backup plan - // to ensure all hot BB will not be missed. - // The query currently has false positives as branch instruction cloning does - // not update/scale branch weights. Unlike false negatives, this will not cause - // performance problem. - uint64_t TotalCount; - auto *TI = B->getTerminator(); - return extractProfTotalWeight(TI, TotalCount) && isHotCount(TotalCount); + return Count && isHotCount(*Count); } bool ProfileSummaryInfo::isColdBB(const BasicBlock *B,