[PATCH] D144924: [BOLT][NFC] Remove BB::getBranchInfo accepting MCSymbol ptr
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 14 15:35:18 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG16e67e6932ef: [BOLT][NFC] Remove BB::getBranchInfo accepting MCSymbol ptr (authored by Amir).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144924/new/
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.505303.patch
Type: text/x-patch
Size: 2604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230314/b3dd3640/attachment.bin>
More information about the llvm-commits
mailing list