[llvm] f6fc503 - [MC] Remove MCStreamer::SymbolOrdering
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 29 17:53:18 PDT 2024
Author: Fangrui Song
Date: 2024-06-29T17:53:13-07:00
New Revision: f6fc503b6791bd7d38ba62c249091eabed297471
URL: https://github.com/llvm/llvm-project/commit/f6fc503b6791bd7d38ba62c249091eabed297471
DIFF: https://github.com/llvm/llvm-project/commit/f6fc503b6791bd7d38ba62c249091eabed297471.diff
LOG: [MC] Remove MCStreamer::SymbolOrdering
21101b32318647f600584d966c697d8773f59629 (2013) added SymbolOrdering,
which essentially became useless when
e3a20f57d927e422874a8e7730bb7590515b586d (2015) removed `AssignSection`
from `EmitLabel`. `assignFragment` is still used in very few places like
emitTBSSSymbol, which do not make a difference if we remove
SymbolOrdering.
Added:
Modified:
llvm/include/llvm/MC/MCStreamer.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/MC/MCStreamer.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index baa9c335920eb..fa8e5c6fe8105 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -228,10 +228,6 @@ class MCStreamer {
WinEH::FrameInfo *CurrentWinFrameInfo;
size_t CurrentProcWinFrameInfoStartIndex;
- /// Tracks an index to represent the order a symbol was emitted in.
- /// Zero means we did not emit that symbol.
- DenseMap<const MCSymbol *, unsigned> SymbolOrdering;
-
/// This is stack of current and previous section values saved by
/// pushSection.
SmallVector<std::pair<MCSectionSubPair, MCSectionSubPair>, 4> SectionStack;
@@ -416,12 +412,6 @@ class MCStreamer {
return CurFrag;
}
- /// Returns an index to represent the order a symbol was emitted in.
- /// (zero if we did not emit that symbol)
- unsigned getSymbolOrder(const MCSymbol *Sym) const {
- return SymbolOrdering.lookup(Sym);
- }
-
/// Save the current and previous section on the section stack.
void pushSection() {
SectionStack.push_back(
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index dd7d9e5deac2e..2addf938c8b63 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -3028,20 +3028,6 @@ void DwarfDebug::emitDebugARanges() {
continue;
}
- // Sort the symbols by offset within the section.
- llvm::stable_sort(List, [&](const SymbolCU &A, const SymbolCU &B) {
- unsigned IA = A.Sym ? Asm->OutStreamer->getSymbolOrder(A.Sym) : 0;
- unsigned IB = B.Sym ? Asm->OutStreamer->getSymbolOrder(B.Sym) : 0;
-
- // Symbols with no order assigned should be placed at the end.
- // (e.g. section end labels)
- if (IA == 0)
- return false;
- if (IB == 0)
- return true;
- return IA < IB;
- });
-
// Insert a final terminator.
List.push_back(SymbolCU(nullptr, Asm->OutStreamer->endSection(Section)));
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 67cb14d729157..470c673a897d8 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -102,7 +102,6 @@ void MCStreamer::reset() {
DwarfFrameInfos.clear();
CurrentWinFrameInfo = nullptr;
WinFrameInfos.clear();
- SymbolOrdering.clear();
SectionStack.clear();
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
CurFrag = nullptr;
@@ -415,10 +414,6 @@ void MCStreamer::initSections(bool NoExecStack, const MCSubtargetInfo &STI) {
void MCStreamer::assignFragment(MCSymbol *Symbol, MCFragment *Fragment) {
assert(Fragment);
Symbol->setFragment(Fragment);
-
- // As we emit symbols into a section, track the order so that they can
- // be sorted upon later. Zero is reserved to mean 'unemitted'.
- SymbolOrdering[Symbol] = 1 + SymbolOrdering.size();
}
void MCStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) {
More information about the llvm-commits
mailing list