[all-commits] [llvm/llvm-project] 8a3921: [Support] Apply `constexpr` to `getTypeName` (#127...

Jordan Rupprecht via All-commits all-commits at lists.llvm.org
Fri Feb 21 08:13:25 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a39214b7e6e79e65135b7dbcc98b427a032d5fb
      https://github.com/llvm/llvm-project/commit/8a39214b7e6e79e65135b7dbcc98b427a032d5fb
  Author: Jordan Rupprecht <rupprecht at google.com>
  Date:   2025-02-21 (Fri, 21 Feb 2025)

  Changed paths:
    M llvm/include/llvm/Support/TypeName.h

  Log Message:
  -----------
  [Support] Apply `constexpr` to `getTypeName` (#127893)

This is a followup to 003a721c1c9e3a99d6d0c1a6755443b260235537, which we
noticed increased binary size a small but noticable amount. The increase
seems to be due to code size from each `llvm::getTypeName<T>` wrapper,
which adds up if there are a lot of types.

The original motivation was to improve runtime and avoid `getTypeName`
being recomputed each time. The implementation is simple enough that we
can make it fully constexpr, which addresses the size increase, but also
further improves runtime: we directly reference the data instead of
jumping through a guard variable to see if we've computed it already.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list