[llvm] r374871 - Change Comments SmallVector to std::vector in DebugLocStream [NFC]

David Stenberg via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 02:21:09 PDT 2019


Author: dstenb
Date: Tue Oct 15 02:21:09 2019
New Revision: 374871

URL: http://llvm.org/viewvc/llvm-project?rev=374871&view=rev
Log:
Change Comments SmallVector to std::vector in DebugLocStream [NFC]

This changes the 32-element SmallVector to a std::vector. When building
a RelWithDebInfo clang-8 binary, the average size of the vector was
~10000, so it does not seem very beneficial or practical to use a small
vector for that.

The DWARFBytes SmallVector grows in the same way as Comments, so perhaps
that also should be changed to a purely dynamically allocated structure,
but that requires some more code changes, so I let that remain as a
SmallVector for now.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/ByteStreamer.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocStream.h

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/ByteStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/ByteStreamer.h?rev=374871&r1=374870&r2=374871&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/ByteStreamer.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/ByteStreamer.h Tue Oct 15 02:21:09 2019
@@ -73,7 +73,7 @@ class HashingByteStreamer final : public
 class BufferByteStreamer final : public ByteStreamer {
 private:
   SmallVectorImpl<char> &Buffer;
-  SmallVectorImpl<std::string> &Comments;
+  std::vector<std::string> &Comments;
 
   /// Only verbose textual output needs comments.  This will be set to
   /// true for that case, and false otherwise.  If false, comments passed in to
@@ -82,7 +82,7 @@ private:
 
 public:
   BufferByteStreamer(SmallVectorImpl<char> &Buffer,
-                     SmallVectorImpl<std::string> &Comments,
+                     std::vector<std::string> &Comments,
                      bool GenerateComments)
   : Buffer(Buffer), Comments(Comments), GenerateComments(GenerateComments) {}
   void EmitInt8(uint8_t Byte, const Twine &Comment) override {

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocStream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocStream.h?rev=374871&r1=374870&r2=374871&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocStream.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocStream.h Tue Oct 15 02:21:09 2019
@@ -48,7 +48,7 @@ private:
   SmallVector<List, 4> Lists;
   SmallVector<Entry, 32> Entries;
   SmallString<256> DWARFBytes;
-  SmallVector<std::string, 32> Comments;
+  std::vector<std::string> Comments;
 
   /// Only verbose textual output needs comments.  This will be set to
   /// true for that case, and false otherwise.




More information about the llvm-commits mailing list