Skip to content

Commit d2071b8

Browse files
committed
Revert "Re-land [MC] Fix quadratic behavior in addPendingLabel"
This reverts commit aa97472. This commit broke ABI compatibility: https://github.com/llvm/llvm-project/runs/624609989
1 parent aa97472 commit d2071b8

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

llvm/include/llvm/MC/MCObjectStreamer.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#ifndef LLVM_MC_MCOBJECTSTREAMER_H
1010
#define LLVM_MC_MCOBJECTSTREAMER_H
1111

12-
#include "llvm/ADT/SetVector.h"
1312
#include "llvm/ADT/SmallVector.h"
1413
#include "llvm/MC/MCAssembler.h"
1514
#include "llvm/MC/MCSection.h"
@@ -39,7 +38,7 @@ class MCObjectStreamer : public MCStreamer {
3938
bool EmitEHFrame;
4039
bool EmitDebugFrame;
4140
SmallVector<MCSymbol *, 2> PendingLabels;
42-
SmallSetVector<MCSection *, 4> PendingLabelSections;
41+
SmallVector<MCSection*, 2> PendingLabelSections;
4342
unsigned CurSubsectionIdx;
4443
struct PendingMCFixup {
4544
const MCSymbol *Sym;

llvm/lib/MC/MCObjectStreamer.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ void MCObjectStreamer::addPendingLabel(MCSymbol* S) {
5959
CurSection->addPendingLabel(S, CurSubsectionIdx);
6060

6161
// Add this Section to the list of PendingLabelSections.
62-
PendingLabelSections.insert(CurSection);
63-
} else
62+
auto SecIt = std::find(PendingLabelSections.begin(),
63+
PendingLabelSections.end(), CurSection);
64+
if (SecIt == PendingLabelSections.end())
65+
PendingLabelSections.push_back(CurSection);
66+
}
67+
else
6468
// There is no Section / Subsection for this label yet.
6569
PendingLabels.push_back(S);
6670
}

0 commit comments

Comments
 (0)