aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/BasicBlockSections.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/BasicBlockSections.cpp')
-rw-r--r--llvm/lib/CodeGen/BasicBlockSections.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/BasicBlockSections.cpp b/llvm/lib/CodeGen/BasicBlockSections.cpp
index 76fe1d9..33e70b1 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 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 @@ 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();
};