[llvm] r297437 - Do not use branch metadata to check if a basic block is hot.

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 17:44:37 PST 2017


Author: dehao
Date: Thu Mar  9 19:44:37 2017
New Revision: 297437

URL: http://llvm.org/viewvc/llvm-project?rev=297437&view=rev
Log:
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

Modified:
    llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp

Modified: llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp?rev=297437&r1=297436&r2=297437&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp Thu Mar  9 19:44:37 2017
@@ -124,18 +124,7 @@ bool ProfileSummaryInfo::isColdCount(uin
 
 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,




More information about the llvm-commits mailing list