Bug 110094 - Support __builtin_mem*_inline
Summary: Support __builtin_mem*_inline
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: unknown
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-02 14:56 UTC by Fangrui Song
Modified: 2023-06-25 03:12 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2023-06-02 14:56:54 UTC
Clang introduced `__builtin_memcpy_inline` (https://reviews.llvm.org/D73543) in 2020 and `__builtin_memset_inline` (https://reviews.llvm.org/D126903) in 2022. The two builtin functions expand memcpy/memset and guarantee that no external functions are called. [1]

Past GCC discussion: https://gcc.gnu.org/pipermail/gcc-patches/2022-December/609138.html ("[RFC] Introduce -finline-memset-loops").

[1]: There are some unhandled cases due to re-combining like https://github.com/llvm/llvm-project/issues/56876
Comment 1 Andrew Pinski 2023-06-02 15:02:21 UTC
I think these builtins are a bad idea.
Comment 2 Andrew Pinski 2023-06-02 15:05:30 UTC
Also there is no definition of what a compile time constant is.

The option supports non constant cases too.