[clang-doc] Move Info types into arenas (#190054)

Info types used to own significant chunks of data. As we move these into
local arenas, these types must be trivially destructible, to avoid
leaking resources when the arena is reset. Unfortunatly, there isn't a
good way to transition all the data types one at a time, since most of
them are tied together in some way. Further, as they're now allocated in
the arenas, they often cannot be treated the same way, and even the
aliases and interfaces put in place to simplify the transition cannot
cover the full range of changes required.

We also use some SFINAE tricks to avoid adding boilerplate for helper
APIs, we'd otherwise have to support

Though it introduces some additional churn, we also try to keep tests
from using arena allocation as much as possible, since this is not
required to test the implementation of the library. As much of the test
code needed to be rewritten anyway, we take the opportunity to
transition now.

We see a large improvement in overall memory use, dropping by 15% over
the previous patches, and taking the total savings down to almost 54%.
Performance numbers stay mostly flat, but merging is vastly improved,
seeing a reduction of 40+% over the previous patch, and a 90% reduction
overall.

| Metric | Baseline | Prev | This | Culm% | Seq% |
| :--- | :--- | :--- | :--- | :--- | :--- |
| Time | 920.5s | 1013.6s | 1014.5s | +10.2% | +0.1% |
| Memory | 86.0G | 47.3G | 39.9G | -53.6% | -15.6% |

| Benchmark | Baseline | Prev | This | Culm% | Seq% |
| :--- | :--- | :--- | :--- | :--- | :--- |
| BM_BitcodeReader_Scale/10 | 67.9us | 69.1us | 73.0us | +7.5% | +5.8% |
| BM_BitcodeReader_Scale/10000 | 70.5ms | 24.5ms | 17.1ms | -75.8% |
-30.4% |
| BM_BitcodeReader_Scale/4096 | 23.2ms | 4.5ms | 6.5ms | -71.9% | +45.1%
|
| BM_BitcodeReader_Scale/512 | 509.4us | 540.3us | 850.1us | +66.9% |
+57.4% |
| BM_BitcodeReader_Scale/64 | 114.8us | 117.3us | 140.6us | +22.5% |
+19.9% |
| BM_EmitInfoFunction | 1.6us | 1.6us | 1.8us | +12.9% | +15.0% |
| BM_Index_Insertion/10 | 2.3us | 4.2us | 4.1us | +79.5% | -1.1% |
| BM_Index_Insertion/10000 | 3.1ms | 5.2ms | 5.4ms | +71.1% | +3.7% |
| BM_Index_Insertion/4096 | 1.3ms | 2.1ms | 2.1ms | +64.9% | +2.0% |
| BM_Index_Insertion/512 | 153.6us | 244.7us | 252.9us | +64.7% | +3.3%
|
| BM_Index_Insertion/64 | 18.1us | 29.1us | 30.4us | +68.3% | +4.4% |
| BM_JSONGenerator_Scale/10 | 36.8us | 38.3us | 38.1us | +3.5% | -0.4% |
| BM_JSONGenerator_Scale/10000 | 89.6ms | 90.8ms | 84.2ms | -6.0% |
-7.2% |
| BM_JSONGenerator_Scale/4096 | 33.7ms | 35.9ms | 32.1ms | -4.7% |
-10.5% |
| BM_JSONGenerator_Scale/512 | 1.9ms | 2.0ms | 2.0ms | +3.1% | +0.4% |
| BM_JSONGenerator_Scale/64 | 222.4us | 231.9us | 232.5us | +4.5% |
+0.2% |
| BM_Mapper_Scale/10000 | 104.3ms | 104.9ms | 102.1ms | -2.1% | -2.7% |
| BM_Mapper_Scale/4096 | 44.3ms | 44.4ms | 46.5ms | +4.9% | +4.9% |
| BM_Mapper_Scale/512 | 7.6ms | 7.6ms | 7.4ms | -2.1% | -1.8% |
| BM_Mapper_Scale/64 | 3.1ms | 3.0ms | 3.0ms | -1.3% | -0.0% |
| BM_MergeInfos_Scale/10000 | 12.2ms | 1.9ms | 931.2us | -92.4% | -49.8%
|
| BM_MergeInfos_Scale/2 | 1.9us | 1.7us | 1.8us | -4.5% | +4.7% |
| BM_MergeInfos_Scale/4096 | 2.8ms | 521.8us | 201.3us | -92.8% | -61.4%
|
| BM_MergeInfos_Scale/512 | 68.9us | 34.9us | 19.9us | -71.2% | -43.1% |
| BM_MergeInfos_Scale/64 | 10.3us | 5.8us | 4.1us | -59.8% | -28.4% |
| BM_MergeInfos_Scale/8 | 2.8us | 2.1us | 1.9us | -33.3% | -12.6% |
| BM_SerializeFunctionInfo | 25.5us | 26.0us | 26.2us | +2.4% | +0.8% |
20 files changed
tree: b2b661143e12207952cc7650d396f0e311244aa9
  1. .ci/
  2. .github/
  3. bolt/
  4. clang/
  5. clang-tools-extra/
  6. cmake/
  7. compiler-rt/
  8. cross-project-tests/
  9. flang/
  10. flang-rt/
  11. libc/
  12. libclc/
  13. libcxx/
  14. libcxxabi/
  15. libsycl/
  16. libunwind/
  17. lld/
  18. lldb/
  19. llvm/
  20. llvm-libgcc/
  21. mlir/
  22. offload/
  23. openmp/
  24. orc-rt/
  25. polly/
  26. runtimes/
  27. third-party/
  28. utils/
  29. .clang-format
  30. .clang-format-ignore
  31. .clang-tidy
  32. .git-blame-ignore-revs
  33. .gitattributes
  34. .gitignore
  35. .mailmap
  36. CODE_OF_CONDUCT.md
  37. CONTRIBUTING.md
  38. LICENSE.TXT
  39. pyproject.toml
  40. README.md
  41. SECURITY.md
README.md

The LLVM Compiler Infrastructure

OpenSSF Scorecard OpenSSF Best Practices libc++

Welcome to the LLVM project!

This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.

The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.

C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.

Other components include: the libc++ C++ standard library, the LLD linker, and more.

Getting the Source Code and Building LLVM

Consult the Getting Started with LLVM page for information on building and running LLVM.

For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.

Getting in touch

Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.

The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.