[PATCH] D144924: [BOLT][NFC] Remove BB::getBranchInfo accepting MCSymbol ptr
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 27 15:17:34 PST 2023
Amir created this revision.
Amir added a reviewer: bolt.
Herald added a reviewer: rafauler.
Herald added subscribers: treapster, ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D144924
Files:
bolt/include/bolt/Core/BinaryBasicBlock.h
bolt/lib/Core/BinaryBasicBlock.cpp
bolt/lib/Passes/IndirectCallPromotion.cpp
Index: bolt/lib/Passes/IndirectCallPromotion.cpp
===================================================================
--- bolt/lib/Passes/IndirectCallPromotion.cpp
+++ bolt/lib/Passes/IndirectCallPromotion.cpp
@@ -257,14 +257,14 @@
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);
}
Index: bolt/lib/Core/BinaryBasicBlock.cpp
===================================================================
--- bolt/lib/Core/BinaryBasicBlock.cpp
+++ bolt/lib/Core/BinaryBasicBlock.cpp
@@ -593,19 +593,6 @@
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");
Index: bolt/include/bolt/Core/BinaryBasicBlock.h
===================================================================
--- bolt/include/bolt/Core/BinaryBasicBlock.h
+++ bolt/include/bolt/Core/BinaryBasicBlock.h
@@ -427,10 +427,6 @@
/// 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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144924.500931.patch
Type: text/x-patch
Size: 2604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230227/b48f600d/attachment.bin>
More information about the llvm-commits
mailing list