diff options
| author | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2020-04-26 10:39:30 -0400 |
|---|---|---|
| committer | Fangrui Song <maskray@google.com> | 2020-04-27 17:30:36 -0700 |
| commit | aa97472d211df67e91e8c1dd3188a0fb2ff942c8 (patch) | |
| tree | efa0b0d810f8019d68f89931e070ac01c91a2509 /llvm/lib | |
| parent | b11ecd196540d87cb7db190d405056984740d2ce (diff) | |
| download | bcm5719-llvm-aa97472d211df67e91e8c1dd3188a0fb2ff942c8.tar.gz bcm5719-llvm-aa97472d211df67e91e8c1dd3188a0fb2ff942c8.zip | |
Re-land [MC] Fix quadratic behavior in addPendingLabel
This was discovered when compiling large unity/blob/jumbo files.
Differential Revision: https://reviews.llvm.org/D78775
(cherry picked from commit fd773e8a51b82775f411061117173a21b500642a)
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/MC/MCObjectStreamer.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index 3d1358df475..e05a0ec11f5 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -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); } |

