summaryrefslogtreecommitdiff
path: root/bolt
diff options
context:
space:
mode:
authorAmir Ayupov <aaupov@fb.com>2023-03-14 15:34:08 -0700
committerAmir Ayupov <aaupov@fb.com>2023-03-14 15:35:05 -0700
commit16e67e6932ef2e82d593eba8203b36ed972c9c45 (patch)
tree876528c10a56a9de39ecb4c9bd79e6071b2d0649 /bolt
parent2f5fe16e6d29c55ebd9ec098b03d4de47a804a18 (diff)
downloadllvm-16e67e6932ef2e82d593eba8203b36ed972c9c45.tar.gz
[BOLT][NFC] Remove BB::getBranchInfo accepting MCSymbol ptr
Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D144924
Diffstat (limited to 'bolt')
-rw-r--r--bolt/include/bolt/Core/BinaryBasicBlock.h4
-rw-r--r--bolt/lib/Core/BinaryBasicBlock.cpp13
-rw-r--r--bolt/lib/Passes/IndirectCallPromotion.cpp6
3 files changed, 3 insertions, 20 deletions
diff --git a/bolt/include/bolt/Core/BinaryBasicBlock.h b/bolt/include/bolt/Core/BinaryBasicBlock.h
index d5f52734bcf3..8c044597b5fd 100644
--- a/bolt/include/bolt/Core/BinaryBasicBlock.h
+++ b/bolt/include/bolt/Core/BinaryBasicBlock.h
@@ -427,10 +427,6 @@ public:
/// Return branch info corresponding to an edge going to \p Succ basic block.
const BinaryBranchInfo &getBranchInfo(const BinaryBasicBlock &Succ) const;
- /// Return branch info corresponding to an edge going to a basic block with
- /// label \p Label.
- BinaryBranchInfo &getBranchInfo(const MCSymbol *Label);
-
/// Set branch information for the outgoing edge to block \p Succ.
void setSuccessorBranchInfo(const BinaryBasicBlock &Succ, uint64_t Count,
uint64_t MispredictedCount) {
diff --git a/bolt/lib/Core/BinaryBasicBlock.cpp b/bolt/lib/Core/BinaryBasicBlock.cpp
index 0a582d709666..b271b86ec699 100644
--- a/bolt/lib/Core/BinaryBasicBlock.cpp
+++ b/bolt/lib/Core/BinaryBasicBlock.cpp
@@ -593,19 +593,6 @@ BinaryBasicBlock::getBranchInfo(const BinaryBasicBlock &Succ) const {
return std::get<1>(*Result);
}
-BinaryBasicBlock::BinaryBranchInfo &
-BinaryBasicBlock::getBranchInfo(const MCSymbol *Label) {
- auto BI = branch_info_begin();
- for (BinaryBasicBlock *BB : successors()) {
- if (BB->getLabel() == Label)
- return *BI;
- ++BI;
- }
-
- llvm_unreachable("Invalid successor");
- return *BI;
-}
-
BinaryBasicBlock *BinaryBasicBlock::splitAt(iterator II) {
assert(II != end() && "expected iterator pointing to instruction");
diff --git a/bolt/lib/Passes/IndirectCallPromotion.cpp b/bolt/lib/Passes/IndirectCallPromotion.cpp
index 8b20fbd368c0..ea8019431cf5 100644
--- a/bolt/lib/Passes/IndirectCallPromotion.cpp
+++ b/bolt/lib/Passes/IndirectCallPromotion.cpp
@@ -257,14 +257,14 @@ IndirectCallPromotion::getCallTargets(BinaryBasicBlock &BB,
JT->EntrySize == BC.AsmInfo->getCodePointerSize());
for (size_t I = Range.first; I < Range.second; ++I, JI += JIAdj) {
MCSymbol *Entry = JT->Entries[I];
- assert(BF.getBasicBlockForLabel(Entry) ||
- Entry == BF.getFunctionEndLabel() ||
+ const BinaryBasicBlock *ToBB = BF.getBasicBlockForLabel(Entry);
+ assert(ToBB || Entry == BF.getFunctionEndLabel() ||
Entry == BF.getFunctionEndLabel(FragmentNum::cold()));
if (Entry == BF.getFunctionEndLabel() ||
Entry == BF.getFunctionEndLabel(FragmentNum::cold()))
continue;
const Location To(Entry);
- const BinaryBasicBlock::BinaryBranchInfo &BI = BB.getBranchInfo(Entry);
+ const BinaryBasicBlock::BinaryBranchInfo &BI = BB.getBranchInfo(*ToBB);
Targets.emplace_back(From, To, BI.MispredictedCount, BI.Count,
I - Range.first);
}