[all-commits] [llvm/llvm-project] 5a7f47: [clang] Optimize clang::Builtin::Info density

serge-sans-paille via All-commits all-commits at lists.llvm.org
Mon Jan 23 05:28:12 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5a7f47cc021bd7a19cb70c9a30755d6b3cb67431
      https://github.com/llvm/llvm-project/commit/5a7f47cc021bd7a19cb70c9a30755d6b3cb67431
  Author: serge-sans-paille <sguelton at mozilla.com>
  Date:   2023-01-23 (Mon, 23 Jan 2023)

  Changed paths:
    A clang/include/clang/Basic/BuiltinHeaders.def
    M clang/include/clang/Basic/Builtins.def
    M clang/include/clang/Basic/Builtins.h
    M clang/include/clang/Basic/BuiltinsAArch64.def
    M clang/include/clang/Basic/BuiltinsARM.def
    M clang/include/clang/Basic/BuiltinsX86.def
    M clang/include/clang/Basic/BuiltinsX86_64.def
    M clang/lib/Basic/Builtins.cpp
    M clang/lib/Basic/Targets/AArch64.cpp
    M clang/lib/Basic/Targets/AMDGPU.cpp
    M clang/lib/Basic/Targets/ARM.cpp
    M clang/lib/Basic/Targets/BPF.cpp
    M clang/lib/Basic/Targets/Hexagon.cpp
    M clang/lib/Basic/Targets/LoongArch.cpp
    M clang/lib/Basic/Targets/Mips.cpp
    M clang/lib/Basic/Targets/NVPTX.cpp
    M clang/lib/Basic/Targets/PPC.cpp
    M clang/lib/Basic/Targets/RISCV.cpp
    M clang/lib/Basic/Targets/SystemZ.cpp
    M clang/lib/Basic/Targets/VE.cpp
    M clang/lib/Basic/Targets/WebAssembly.cpp
    M clang/lib/Basic/Targets/X86.cpp
    M clang/lib/Basic/Targets/XCore.cpp

  Log Message:
  -----------
  [clang] Optimize clang::Builtin::Info density

Reorganize clang::Builtin::Info to have them naturally align on 4 bytes
boundaries.

Instead of storing builtin headers as a straight char pointer, enumerate
them and store the enum. It allows to use a small enum instead of a
pointer to reference them.

On a 64 bit machine, this brings sizeof(clang::Builtin::Info) from 56
down to 48 bytes.

On a release build on my Linux 64 bit machine, it shrinks the size of
libclang-cpp.so by 193kB.

The impact on performance is negligible in terms of instruction count,
but the wall time seems better, see
https://llvm-compile-time-tracker.com/compare.php?from=b3d8639f3536a4876b511aca9fb7948ff9266cee&to=a89b56423f98b550260a58c41e64aff9e56b76be&stat=task-clock

Differential Revision: https://reviews.llvm.org/D142024




More information about the All-commits mailing list