[PATCH] D78775: [MC] Fix quadratic behavior in addPendingLabel
Alexandre Ganea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 26 07:57:52 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfd773e8a51b8: Re-land [MC] Fix quadratic behavior in addPendingLabel (authored by aganea).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78775/new/
https://reviews.llvm.org/D78775
Files:
llvm/include/llvm/MC/MCObjectStreamer.h
llvm/lib/MC/MCObjectStreamer.cpp
Index: llvm/lib/MC/MCObjectStreamer.cpp
===================================================================
--- llvm/lib/MC/MCObjectStreamer.cpp
+++ 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);
}
Index: llvm/include/llvm/MC/MCObjectStreamer.h
===================================================================
--- llvm/include/llvm/MC/MCObjectStreamer.h
+++ llvm/include/llvm/MC/MCObjectStreamer.h
@@ -9,6 +9,7 @@
#ifndef LLVM_MC_MCOBJECTSTREAMER_H
#define LLVM_MC_MCOBJECTSTREAMER_H
+#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCSection.h"
@@ -38,7 +39,7 @@
bool EmitEHFrame;
bool EmitDebugFrame;
SmallVector<MCSymbol *, 2> PendingLabels;
- SmallVector<MCSection*, 2> PendingLabelSections;
+ SmallSetVector<MCSection *, 4> PendingLabelSections;
unsigned CurSubsectionIdx;
struct PendingMCFixup {
const MCSymbol *Sym;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78775.260167.patch
Type: text/x-patch
Size: 1436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200426/7f08c5a3/attachment.bin>
More information about the llvm-commits
mailing list