[llvm-branch-commits] [llvm] d2071b8 - Revert "Re-land [MC] Fix quadratic behavior in addPendingLabel"

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Apr 29 11:09:44 PDT 2020


Author: Tom Stellard
Date: 2020-04-29T11:08:42-07:00
New Revision: d2071b8fcdc5e8794d467cec9ebab735d09218bf

URL: https://github.com/llvm/llvm-project/commit/d2071b8fcdc5e8794d467cec9ebab735d09218bf
DIFF: https://github.com/llvm/llvm-project/commit/d2071b8fcdc5e8794d467cec9ebab735d09218bf.diff

LOG: Revert "Re-land [MC] Fix quadratic behavior in addPendingLabel"

This reverts commit aa97472d211df67e91e8c1dd3188a0fb2ff942c8.

This commit broke ABI compatibility:
https://github.com/llvm/llvm-project/runs/624609989

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCObjectStreamer.h
    llvm/lib/MC/MCObjectStreamer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCObjectStreamer.h b/llvm/include/llvm/MC/MCObjectStreamer.h
index 701cdf30b479..9e3f87565e26 100644
--- a/llvm/include/llvm/MC/MCObjectStreamer.h
+++ b/llvm/include/llvm/MC/MCObjectStreamer.h
@@ -9,7 +9,6 @@
 #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"
@@ -39,7 +38,7 @@ class MCObjectStreamer : public MCStreamer {
   bool EmitEHFrame;
   bool EmitDebugFrame;
   SmallVector<MCSymbol *, 2> PendingLabels;
-  SmallSetVector<MCSection *, 4> PendingLabelSections;
+  SmallVector<MCSection*, 2> PendingLabelSections;
   unsigned CurSubsectionIdx;
   struct PendingMCFixup {
     const MCSymbol *Sym;

diff  --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index e05a0ec11f56..3d1358df475f 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -59,8 +59,12 @@ void MCObjectStreamer::addPendingLabel(MCSymbol* S) {
     CurSection->addPendingLabel(S, CurSubsectionIdx);
 
     // Add this Section to the list of PendingLabelSections.
-    PendingLabelSections.insert(CurSection);
-  } else
+    auto SecIt = std::find(PendingLabelSections.begin(),
+                           PendingLabelSections.end(), CurSection);
+    if (SecIt == PendingLabelSections.end())
+      PendingLabelSections.push_back(CurSection);
+  }
+  else
     // There is no Section / Subsection for this label yet.
     PendingLabels.push_back(S);
 }


        


More information about the llvm-branch-commits mailing list