diff --git a/llvm/include/llvm/MC/MCObjectStreamer.h b/llvm/include/llvm/MC/MCObjectStreamer.h --- a/llvm/include/llvm/MC/MCObjectStreamer.h +++ b/llvm/include/llvm/MC/MCObjectStreamer.h @@ -38,7 +38,7 @@ bool EmitEHFrame; bool EmitDebugFrame; SmallVector PendingLabels; - SmallVector PendingLabelSections; + SmallPtrSet PendingLabelSections; unsigned CurSubsectionIdx; struct PendingMCFixup { const MCSymbol *Sym; diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -59,12 +59,8 @@ 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); }