[llvm] 1993b73 - [Analaysis, CodeGen] Remove getHotSucc (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 17 07:31:51 PDT 2021
Author: Kazu Hirata
Date: 2021-07-17T07:31:36-07:00
New Revision: 1993b73755b8f58b0de5c08d95f12722644c79aa
URL: https://github.com/llvm/llvm-project/commit/1993b73755b8f58b0de5c08d95f12722644c79aa
DIFF: https://github.com/llvm/llvm-project/commit/1993b73755b8f58b0de5c08d95f12722644c79aa.diff
LOG: [Analaysis, CodeGen] Remove getHotSucc (NFC)
These functions seem to be unused for at least 5 years.
Added:
Modified:
llvm/include/llvm/Analysis/BranchProbabilityInfo.h
llvm/include/llvm/CodeGen/MachineBranchProbabilityInfo.h
llvm/lib/Analysis/BranchProbabilityInfo.cpp
llvm/lib/CodeGen/MachineBranchProbabilityInfo.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/BranchProbabilityInfo.h b/llvm/include/llvm/Analysis/BranchProbabilityInfo.h
index 6a286236a80e..e2099eba0f65 100644
--- a/llvm/include/llvm/Analysis/BranchProbabilityInfo.h
+++ b/llvm/include/llvm/Analysis/BranchProbabilityInfo.h
@@ -168,12 +168,6 @@ class BranchProbabilityInfo {
/// as having a relative probability >= 80%.
bool isEdgeHot(const BasicBlock *Src, const BasicBlock *Dst) const;
- /// Retrieve the hot successor of a block if one exists.
- ///
- /// Given a basic block, look through its successors and if one exists for
- /// which \see isEdgeHot would return true, return that successor block.
- const BasicBlock *getHotSucc(const BasicBlock *BB) const;
-
/// Print an edge's probability.
///
/// Retrieves an edge's probability similarly to \see getEdgeProbability, but
diff --git a/llvm/include/llvm/CodeGen/MachineBranchProbabilityInfo.h b/llvm/include/llvm/CodeGen/MachineBranchProbabilityInfo.h
index cde3bc08692b..7e7e0a9c477a 100644
--- a/llvm/include/llvm/CodeGen/MachineBranchProbabilityInfo.h
+++ b/llvm/include/llvm/CodeGen/MachineBranchProbabilityInfo.h
@@ -55,10 +55,6 @@ class MachineBranchProbabilityInfo : public ImmutablePass {
bool isEdgeHot(const MachineBasicBlock *Src,
const MachineBasicBlock *Dst) const;
- // Return a hot successor for the block BB or null if there isn't one.
- // NB: This routine's complexity is linear on the number of successors.
- MachineBasicBlock *getHotSucc(MachineBasicBlock *MBB) const;
-
// Print value between 0 (0% probability) and 1 (100% probability),
// however the value is never equal to 0, and can be 1 only iff SRC block
// has only one successor.
diff --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp
index 798d0785de01..aa6b93fe3f07 100644
--- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp
+++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp
@@ -1105,26 +1105,6 @@ isEdgeHot(const BasicBlock *Src, const BasicBlock *Dst) const {
return getEdgeProbability(Src, Dst) > BranchProbability(4, 5);
}
-const BasicBlock *
-BranchProbabilityInfo::getHotSucc(const BasicBlock *BB) const {
- auto MaxProb = BranchProbability::getZero();
- const BasicBlock *MaxSucc = nullptr;
-
- for (const auto *Succ : successors(BB)) {
- auto Prob = getEdgeProbability(BB, Succ);
- if (Prob > MaxProb) {
- MaxProb = Prob;
- MaxSucc = Succ;
- }
- }
-
- // Hot probability is at least 4/5 = 80%
- if (MaxProb > BranchProbability(4, 5))
- return MaxSucc;
-
- return nullptr;
-}
-
/// Get the raw edge probability for the edge. If can't find it, return a
/// default probability 1/N where N is the number of successors. Here an edge is
/// specified using PredBlock and an
diff --git a/llvm/lib/CodeGen/MachineBranchProbabilityInfo.cpp b/llvm/lib/CodeGen/MachineBranchProbabilityInfo.cpp
index 85924bec94a7..c9f762f9a6e7 100644
--- a/llvm/lib/CodeGen/MachineBranchProbabilityInfo.cpp
+++ b/llvm/lib/CodeGen/MachineBranchProbabilityInfo.cpp
@@ -68,26 +68,6 @@ bool MachineBranchProbabilityInfo::isEdgeHot(
return getEdgeProbability(Src, Dst) > HotProb;
}
-MachineBasicBlock *
-MachineBranchProbabilityInfo::getHotSucc(MachineBasicBlock *MBB) const {
- auto MaxProb = BranchProbability::getZero();
- MachineBasicBlock *MaxSucc = nullptr;
- for (MachineBasicBlock::const_succ_iterator I = MBB->succ_begin(),
- E = MBB->succ_end(); I != E; ++I) {
- auto Prob = getEdgeProbability(MBB, I);
- if (Prob > MaxProb) {
- MaxProb = Prob;
- MaxSucc = *I;
- }
- }
-
- BranchProbability HotProb(StaticLikelyProb, 100);
- if (getEdgeProbability(MBB, MaxSucc) >= HotProb)
- return MaxSucc;
-
- return nullptr;
-}
-
raw_ostream &MachineBranchProbabilityInfo::printEdgeProbability(
raw_ostream &OS, const MachineBasicBlock *Src,
const MachineBasicBlock *Dst) const {
More information about the llvm-commits
mailing list