[lld] d97749f - [ELF] Switch split-stack to use SmallVector. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 1 00:09:35 PST 2022


Author: Fangrui Song
Date: 2022-02-01T00:09:30-08:00
New Revision: d97749fabcff7d165d2ae1f4c92323877952c7a2

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

LOG: [ELF] Switch split-stack to use SmallVector. NFC

My x86-64 lld executable is 1.1KiB smaller.

Added: 
    

Modified: 
    lld/ELF/InputSection.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 131b22feb46ef..66abe20019734 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -1126,7 +1126,8 @@ void InputSectionBase::relocateAlloc(uint8_t *buf, uint8_t *bufEnd) {
 // For each function-defining prologue, find any calls to __morestack,
 // and replace them with calls to __morestack_non_split.
 static void switchMorestackCallsToMorestackNonSplit(
-    DenseSet<Defined *> &prologues, std::vector<Relocation *> &morestackCalls) {
+    DenseSet<Defined *> &prologues,
+    SmallVector<Relocation *, 0> &morestackCalls) {
 
   // If the target adjusted a function's prologue, all calls to
   // __morestack inside that function should be switched to
@@ -1176,7 +1177,7 @@ template <class ELFT>
 void InputSectionBase::adjustSplitStackFunctionPrologues(uint8_t *buf,
                                                          uint8_t *end) {
   DenseSet<Defined *> prologues;
-  std::vector<Relocation *> morestackCalls;
+  SmallVector<Relocation *, 0> morestackCalls;
 
   for (Relocation &rel : relocations) {
     // Ignore calls into the split-stack api.


        


More information about the llvm-commits mailing list