1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[MC] Fix quadratic behavior in addPendingLabel()

Differential Revision: https://reviews.llvm.org/D78775
This commit is contained in:
Alexandre Ganea 2020-04-24 12:48:39 -04:00
parent 7ae40fa35c
commit 1bcb4a0fed
2 changed files with 3 additions and 7 deletions

View File

@ -38,7 +38,7 @@ class MCObjectStreamer : public MCStreamer {
bool EmitEHFrame;
bool EmitDebugFrame;
SmallVector<MCSymbol *, 2> PendingLabels;
SmallVector<MCSection*, 2> PendingLabelSections;
SmallPtrSet<MCSection *, 4> PendingLabelSections;
unsigned CurSubsectionIdx;
struct PendingMCFixup {
const MCSymbol *Sym;

View File

@ -59,12 +59,8 @@ void MCObjectStreamer::addPendingLabel(MCSymbol* S) {
CurSection->addPendingLabel(S, CurSubsectionIdx);
// Add this Section to the list of PendingLabelSections.
auto SecIt = std::find(PendingLabelSections.begin(),
PendingLabelSections.end(), CurSection);
if (SecIt == PendingLabelSections.end())
PendingLabelSections.push_back(CurSection);
}
else
PendingLabelSections.insert(CurSection);
} else
// There is no Section / Subsection for this label yet.
PendingLabels.push_back(S);
}