[CodeView] Eliminate redundant hashes and allocations.
authorZachary Turner <zturner@google.com>
Tue, 23 May 2017 18:56:23 +0000 (18:56 +0000)
committerZachary Turner <zturner@google.com>
Tue, 23 May 2017 18:56:23 +0000 (18:56 +0000)
commit7daf62e7436ad5ff7fced724195371b1a28b0423
tree7b454237fc968429af6db8c819325fc9850cbf85
parentc44a727ee43fa143528a51765905943fc681bd8b
[CodeView] Eliminate redundant hashes and allocations.

When writing field list records, we would construct a temporary
type serializer that shared a bump ptr allocator with the rest
of the application, so anything allocated from here would live
forever.  Furthermore, this temporary serializer had all the
properties of a full blown serializer including record hashing
and de-duplication.

These features are required when you're merging multiple type
streams into each other, because different streams may contain
identical records, but records from the same type stream will
never collide with each other.  So all of this hashing was
unnecessary.

To solve this, two fixes are made:

1) The temporary serializer keeps its own bump ptr allocator
instead of sharing a global one.  When it's finished, all of
its memory is freed.

2) Instead of using the same temporary serializer for the life
of an entire type stream, we use it only for the life of a single
field list record and delete it when the field list record is
completed.  This way the hash table will not grow as other
records from the same type stream get inserted.  Further improvements
could eliminate hashing entirely from this codepath.

This reduces the link time by 85% in my test, from 1 minute to 9
seconds.

llvm-svn: 303676
llvm/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h
llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp