[llvm] 69e47de - [Propeller] Deprecate Codegen paths for SHT_LLVM_BB_ADDR_MAP version 1.
Rahman Lavaee via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 20 11:29:53 PDT 2023
Author: Rahman Lavaee
Date: 2023-08-20T18:29:47Z
New Revision: 69e47deca97b9a7f7394e5472095ee32e46f1831
URL: https://github.com/llvm/llvm-project/commit/69e47deca97b9a7f7394e5472095ee32e46f1831
DIFF: https://github.com/llvm/llvm-project/commit/69e47deca97b9a7f7394e5472095ee32e46f1831.diff
LOG: [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
Added:
Modified:
llvm/include/llvm/CodeGen/MachineBasicBlock.h
llvm/lib/CodeGen/BasicBlockSections.cpp
llvm/lib/CodeGen/MachineBasicBlock.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
index 0107981364fba5..97c9649471fb61 100644
--- a/llvm/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
@@ -635,12 +635,6 @@ class MachineBasicBlock
std::optional<unsigned> 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
index 76fe1d96dbccf1..33e70b160d9212 100644
--- a/llvm/lib/CodeGen/BasicBlockSections.cpp
+++ b/llvm/lib/CodeGen/BasicBlockSections.cpp
@@ -225,9 +225,7 @@ assignSections(MachineFunction &MF,
// 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 @@ bool BasicBlockSections::runOnMachineFunction(MachineFunction &MF) {
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
diff erent 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 @@ bool BasicBlockSections::runOnMachineFunction(MachineFunction &MF) {
// 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
index 8e7b2d7e1e8721..280ced65db7d8c 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -1736,11 +1736,6 @@ bool MachineBasicBlock::sizeWithoutDebugLargerThan(unsigned Limit) const {
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);
More information about the llvm-commits
mailing list