This is an archive of the discontinued LLVM Phabricator instance.

[Support] Split MallocAllocator out of Allocator.h
ClosedPublic

Authored by rnk on Jan 24 2020, 4:32 PM.

Details

Summary

StringMap.h is very popular (4K uses), and it doesn't need to see
BumpPtrAllocator, which is relatively expensive according to
ClangBuildAnalyzer. StringMap only needs MallocAllocator, so split that
into AllocatorBase.h and use it instead.

Here is the change in header uses:
$ diff -u thedeps-before.txt thedeps-after.txt | \

 grep '^[-+] ' |  sort | uniq -c | sort -nr
3993 +    ../llvm/include/llvm/Support/AllocatorBase.h
 758 -    ../llvm/include/llvm/Support/Allocator.h
 270 -    ../llvm/include/llvm/Support/Alignment.h
  13 -    ../llvm/include/llvm/Support/Host.h
   6 -    ../llvm/include/llvm/ADT/StringMap.h
   4 -    ../llvm/include/llvm/Support/SwapByteOrder.h
   4 -    ../llvm/include/llvm/Support/MathExtras.h
   4 -    ../llvm/include/llvm/Support/AlignOf.h
   4 -    ../llvm/include/llvm/ADT/SmallVector.h
   1 -    ../llvm/include/llvm/Support/PointerLikeTypeTraits.h

Diff Detail

Event Timeline

rnk created this revision.Jan 24 2020, 4:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 24 2020, 4:32 PM

Unit tests: unknown.

clang-tidy: fail. clang-tidy found 2 errors and 6 warnings. 0 of them are added as review comments below (why?).

clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

MaskRay accepted this revision.Jan 24 2020, 5:09 PM
MaskRay added inline comments.
llvm/include/llvm/BinaryFormat/MachO.h
18

This looks like an unrelated change. It will be nice to commit it separately.

This revision is now accepted and ready to land.Jan 24 2020, 5:09 PM
rnk marked an inline comment as done.Jan 24 2020, 5:28 PM

Thanks!

llvm/include/llvm/BinaryFormat/MachO.h
18

It is related via this chain:

Host.h ->
StringMap.h ->
Allocator.h (removed in this change) ->
MathExtras.h ->
SwapByteOrder.h
This revision was automatically updated to reflect the committed changes.