diff --git a/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/llvm/include/llvm/CodeGen/MachineBasicBlock.h --- a/llvm/include/llvm/CodeGen/MachineBasicBlock.h +++ b/llvm/include/llvm/CodeGen/MachineBasicBlock.h @@ -635,12 +635,6 @@ std::optional getBBID() const { return BBID; } - /// Returns the BBID of the block when BBAddrMapVersion >= 2, otherwise - /// returns `MachineBasicBlock::Number`. - /// TODO: Remove this function when version 1 is deprecated and replace its - /// uses with `getBBID()`. - unsigned getBBIDOrNumber() const; - /// Returns the section ID of this basic block. MBBSectionID getSectionID() const { return SectionID; } diff --git a/llvm/lib/CodeGen/BasicBlockSections.cpp b/llvm/lib/CodeGen/BasicBlockSections.cpp --- a/llvm/lib/CodeGen/BasicBlockSections.cpp +++ b/llvm/lib/CodeGen/BasicBlockSections.cpp @@ -225,9 +225,7 @@ // blocks are ordered canonically. MBB.setSectionID(MBB.getNumber()); } else { - // TODO: Replace `getBBIDOrNumber` with `getBBID` once version 1 is - // deprecated. - auto I = FuncBBClusterInfo.find(MBB.getBBIDOrNumber()); + auto I = FuncBBClusterInfo.find(*MBB.getBBID()); if (I != FuncBBClusterInfo.end()) { MBB.setSectionID(I->second.ClusterID); } else { @@ -325,14 +323,8 @@ if (BBSectionsType == BasicBlockSection::List && hasInstrProfHashMismatch(MF)) return true; - // Renumber blocks before sorting them. This is useful during sorting, - // basic blocks in the same section will retain the default order. - // This renumbering should also be done for basic block labels to match the - // profiles with the correct blocks. - // For LLVM_BB_ADDR_MAP versions 2 and higher, this renumbering serves - // the different purpose of accessing the original layout positions and - // finding the original fallthroughs. - // TODO: Change the above comment accordingly when version 1 is deprecated. + // Renumber blocks before sorting them. This is useful for accessing the + // original layout positions and finding the original fallthroughs. MF.RenumberBlocks(); if (BBSectionsType == BasicBlockSection::Labels) { @@ -383,8 +375,8 @@ // If the two basic block are in the same section, the order is decided by // their position within the section. if (XSectionID.Type == MBBSectionID::SectionType::Default) - return FuncBBClusterInfo.lookup(X.getBBIDOrNumber()).PositionInCluster < - FuncBBClusterInfo.lookup(Y.getBBIDOrNumber()).PositionInCluster; + return FuncBBClusterInfo.lookup(*X.getBBID()).PositionInCluster < + FuncBBClusterInfo.lookup(*Y.getBBID()).PositionInCluster; return X.getNumber() < Y.getNumber(); }; diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -1736,11 +1736,6 @@ return false; } -unsigned MachineBasicBlock::getBBIDOrNumber() const { - uint8_t BBAddrMapVersion = getParent()->getContext().getBBAddrMapVersion(); - return BBAddrMapVersion < 2 ? getNumber() : *getBBID(); -} - const MBBSectionID MBBSectionID::ColdSectionID(MBBSectionID::SectionType::Cold); const MBBSectionID MBBSectionID::ExceptionSectionID(MBBSectionID::SectionType::Exception);