From 1993b73755b8f58b0de5c08d95f12722644c79aa Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 17 Jul 2021 07:31:36 -0700 Subject: [PATCH] [Analaysis, CodeGen] Remove getHotSucc (NFC) These functions seem to be unused for at least 5 years. --- llvm/include/llvm/Analysis/BranchProbabilityInfo.h | 6 ------ .../llvm/CodeGen/MachineBranchProbabilityInfo.h | 4 ---- llvm/lib/Analysis/BranchProbabilityInfo.cpp | 20 -------------------- llvm/lib/CodeGen/MachineBranchProbabilityInfo.cpp | 20 -------------------- 4 files changed, 50 deletions(-) diff --git a/llvm/include/llvm/Analysis/BranchProbabilityInfo.h b/llvm/include/llvm/Analysis/BranchProbabilityInfo.h index 6a28623..e2099eb 100644 --- a/llvm/include/llvm/Analysis/BranchProbabilityInfo.h +++ b/llvm/include/llvm/Analysis/BranchProbabilityInfo.h @@ -168,12 +168,6 @@ public: /// 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 cde3bc0..7e7e0a9 100644 --- a/llvm/include/llvm/CodeGen/MachineBranchProbabilityInfo.h +++ b/llvm/include/llvm/CodeGen/MachineBranchProbabilityInfo.h @@ -55,10 +55,6 @@ public: 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 798d078..aa6b93f 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 85924be..c9f762f 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 { -- 2.7.4