Skip to content

Commit 69e47de

Browse files
committed
[Propeller] Deprecate Codegen paths for SHT_LLVM_BB_ADDR_MAP version 1.
This patch removes the `getBBIDOrNumber` which was introduced to allow emitting version 1. Reviewed By: shenhan Differential Revision: https://reviews.llvm.org/D158299
1 parent 0db1ae3 commit 69e47de

File tree

3 files changed

+5
-24
lines changed

3 files changed

+5
-24
lines changed

llvm/include/llvm/CodeGen/MachineBasicBlock.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -635,12 +635,6 @@ class MachineBasicBlock
635635

636636
std::optional<unsigned> getBBID() const { return BBID; }
637637

638-
/// Returns the BBID of the block when BBAddrMapVersion >= 2, otherwise
639-
/// returns `MachineBasicBlock::Number`.
640-
/// TODO: Remove this function when version 1 is deprecated and replace its
641-
/// uses with `getBBID()`.
642-
unsigned getBBIDOrNumber() const;
643-
644638
/// Returns the section ID of this basic block.
645639
MBBSectionID getSectionID() const { return SectionID; }
646640

llvm/lib/CodeGen/BasicBlockSections.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,7 @@ assignSections(MachineFunction &MF,
225225
// blocks are ordered canonically.
226226
MBB.setSectionID(MBB.getNumber());
227227
} else {
228-
// TODO: Replace `getBBIDOrNumber` with `getBBID` once version 1 is
229-
// deprecated.
230-
auto I = FuncBBClusterInfo.find(MBB.getBBIDOrNumber());
228+
auto I = FuncBBClusterInfo.find(*MBB.getBBID());
231229
if (I != FuncBBClusterInfo.end()) {
232230
MBB.setSectionID(I->second.ClusterID);
233231
} else {
@@ -325,14 +323,8 @@ bool BasicBlockSections::runOnMachineFunction(MachineFunction &MF) {
325323
if (BBSectionsType == BasicBlockSection::List &&
326324
hasInstrProfHashMismatch(MF))
327325
return true;
328-
// Renumber blocks before sorting them. This is useful during sorting,
329-
// basic blocks in the same section will retain the default order.
330-
// This renumbering should also be done for basic block labels to match the
331-
// profiles with the correct blocks.
332-
// For LLVM_BB_ADDR_MAP versions 2 and higher, this renumbering serves
333-
// the different purpose of accessing the original layout positions and
334-
// finding the original fallthroughs.
335-
// TODO: Change the above comment accordingly when version 1 is deprecated.
326+
// Renumber blocks before sorting them. This is useful for accessing the
327+
// original layout positions and finding the original fallthroughs.
336328
MF.RenumberBlocks();
337329

338330
if (BBSectionsType == BasicBlockSection::Labels) {
@@ -383,8 +375,8 @@ bool BasicBlockSections::runOnMachineFunction(MachineFunction &MF) {
383375
// If the two basic block are in the same section, the order is decided by
384376
// their position within the section.
385377
if (XSectionID.Type == MBBSectionID::SectionType::Default)
386-
return FuncBBClusterInfo.lookup(X.getBBIDOrNumber()).PositionInCluster <
387-
FuncBBClusterInfo.lookup(Y.getBBIDOrNumber()).PositionInCluster;
378+
return FuncBBClusterInfo.lookup(*X.getBBID()).PositionInCluster <
379+
FuncBBClusterInfo.lookup(*Y.getBBID()).PositionInCluster;
388380
return X.getNumber() < Y.getNumber();
389381
};
390382

llvm/lib/CodeGen/MachineBasicBlock.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,11 +1736,6 @@ bool MachineBasicBlock::sizeWithoutDebugLargerThan(unsigned Limit) const {
17361736
return false;
17371737
}
17381738

1739-
unsigned MachineBasicBlock::getBBIDOrNumber() const {
1740-
uint8_t BBAddrMapVersion = getParent()->getContext().getBBAddrMapVersion();
1741-
return BBAddrMapVersion < 2 ? getNumber() : *getBBID();
1742-
}
1743-
17441739
const MBBSectionID MBBSectionID::ColdSectionID(MBBSectionID::SectionType::Cold);
17451740
const MBBSectionID
17461741
MBBSectionID::ExceptionSectionID(MBBSectionID::SectionType::Exception);

0 commit comments

Comments
 (0)