[all-commits] [llvm/llvm-project] 713839: [Clang] Add __builtin_invoke and use it in libc++ ...

Nikolas Klauser via All-commits all-commits at lists.llvm.org
Sun Jun 29 08:53:11 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 713839729c97d1ac9492c516d0bf5e1add27fbd3
      https://github.com/llvm/llvm-project/commit/713839729c97d1ac9492c516d0bf5e1add27fbd3
  Author: Nikolas Klauser <nikolasklauser at berlin.de>
  Date:   2025-06-29 (Sun, 29 Jun 2025)

  Changed paths:
    M clang/docs/LanguageExtensions.rst
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/Builtins.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaChecking.cpp
    M clang/lib/Sema/SemaTypeTraits.cpp
    A clang/test/CodeGenCXX/builtin-invoke.cpp
    A clang/test/SemaCXX/builtin-invoke.cpp
    M libcxx/include/__type_traits/invoke.h
    M libcxx/include/__type_traits/is_core_convertible.h

  Log Message:
  -----------
  [Clang] Add __builtin_invoke and use it in libc++ (#116709)

`std::invoke` is currently quite heavy compared to a function call,
since it involves quite heavy SFINAE. This can be done significantly
more efficient by the compiler, since most calls to `std::invoke` are
simple function calls and 6 out of the seven overloads for `std::invoke`
exist only to support member pointers. Even these boil down to a few
relatively simple checks.

Some real-world testing with this patch revealed some significant
results. For example, instantiating `std::format("Banane")` (and its
callees) went down from ~125ms on my system to ~104ms.



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