[PATCH] D32647: [ELF] - Do not produce duplicate values in .gdb_index's constant pool area.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 05:53:22 PDT 2017


Thanks for review, Rafael !
I updated the diff with your comments addressed.

Rui, are you ok to land it ?

>Why do you need "-e main"?
Removed.

>> Index: ELF/SyntheticSections.h
>> ===================================================================
>> --- ELF/SyntheticSections.h
>> +++ ELF/SyntheticSections.h
>> @@ -25,6 +25,7 @@
>>  #include "GdbIndex.h"
>>  #include "InputSection.h"
>>  #include "llvm/ADT/MapVector.h"
>> +#include "llvm/ADT/SetVector.h"
>>  #include "llvm/MC/StringTableBuilder.h"
>>
>>  namespace lld {
>> @@ -511,7 +512,7 @@
>>    GdbHashTab SymbolTable;
>>
>>    // The CU vector portion of the constant pool.
>> -  std::vector<std::vector<std::pair<uint32_t, uint8_t>>> CuVectors;
>> +  std::vector<llvm::SmallSetVector<uint32_t, 8>> CuVectors;
>
>Why Small? These are normally good for stack variables, but are actually
>pretty big.
>

I looked into output produced by linking LLC and it looks that size of 8 is almost always
enough for that sets. I supposed that using SmallSetVector can help to reduce amount of heap allocations.
Though probably allocations is not a problem at all here.
I think we also need to keep insertion or sorted order for deterministic output, so I updated the diff to use simple std::set.

>LGTM with these nits fixed.
>
>Cheers,
>Rafael

Best regards,
George | Developer | Access Softek, Inc


More information about the llvm-commits mailing list