Skip to content

Commit

Permalink
[MC] Fix quadratic behavior in addPendingLabel()
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D78775
  • Loading branch information
aganea committed Apr 24, 2020
1 parent 6395980 commit e98f73a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion llvm/include/llvm/MC/MCObjectStreamer.h
Expand Up @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions llvm/lib/MC/MCObjectStreamer.cpp
Expand Up @@ -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);
}
Expand Down

0 comments on commit e98f73a

Please sign in to comment.