[llvm-branch-commits] [lld] dfcf1ac - [ELF] Improve 2 SmallVector<*, N> usage
Fangrui Song via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Nov 29 14:06:07 PST 2020
Author: Fangrui Song
Date: 2020-11-29T14:01:32-08:00
New Revision: dfcf1acf13226be0f599a7ab6b395b66dc9545d6
URL: https://github.com/llvm/llvm-project/commit/dfcf1acf13226be0f599a7ab6b395b66dc9545d6
DIFF: https://github.com/llvm/llvm-project/commit/dfcf1acf13226be0f599a7ab6b395b66dc9545d6.diff
LOG: [ELF] Improve 2 SmallVector<*, N> usage
For --gc-sections, SmallVector<InputSection *, 256> -> SmallVector<InputSection *, 0> because the code bloat (1296 bytes) is not worthwhile (the saved reallocation is negligible).
For OutputSection::compressedData, N=1 is useless (for a compressed .debug_*, the size is always larger than 1).
Added:
Modified:
lld/ELF/MarkLive.cpp
lld/ELF/OutputSections.h
Removed:
################################################################################
diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp
index 2c350e275e6c..35220e168df3 100644
--- a/lld/ELF/MarkLive.cpp
+++ b/lld/ELF/MarkLive.cpp
@@ -65,7 +65,7 @@ template <class ELFT> class MarkLive {
unsigned partition;
// A list of sections to visit.
- SmallVector<InputSection *, 256> queue;
+ SmallVector<InputSection *, 0> queue;
// There are normally few input sections whose names are valid C
// identifiers, so we just store a std::vector instead of a multimap.
diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h
index d5686f11ec8e..39bf48c091ca 100644
--- a/lld/ELF/OutputSections.h
+++ b/lld/ELF/OutputSections.h
@@ -111,7 +111,7 @@ class OutputSection final : public BaseCommand, public SectionBase {
private:
// Used for implementation of --compress-debug-sections option.
std::vector<uint8_t> zDebugHeader;
- llvm::SmallVector<char, 1> compressedData;
+ llvm::SmallVector<char, 0> compressedData;
std::array<uint8_t, 4> getFiller();
};
More information about the llvm-branch-commits
mailing list