]> granicus.if.org Git - llvm/commitdiff
Do not use branch metadata to check if a basic block is hot.
authorDehao Chen <dehao@google.com>
Fri, 10 Mar 2017 01:44:37 +0000 (01:44 +0000)
committerDehao Chen <dehao@google.com>
Fri, 10 Mar 2017 01:44:37 +0000 (01:44 +0000)
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

lib/Analysis/ProfileSummaryInfo.cpp

index 5ca1830333889d4e0b00d8d5eaa9944904d04435..623c9fac52acc16bb4dd4537fdf47b1e46d7efc5 100644 (file)
@@ -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,