[libc-commits] [libc] [libc] Remove unnecessary call in memfunction dispatchers (PR #75800)

Dmitry Vyukov via libc-commits libc-commits at lists.llvm.org
Mon Dec 18 06:51:10 PST 2023


================
@@ -32,7 +32,8 @@
 
 namespace LIBC_NAMESPACE {
 
-LIBC_INLINE int inline_bcmp(const void *p1, const void *p2, size_t count) {
+__attribute__((flatten)) LIBC_INLINE int
----------------
dvyukov wrote:

My understanding that flatten should be applied to top-level functions, rather than helper functions.
It's the top level function that needs to flattened. If overall amount of code is so large that compiler stops inlining, then it may as well flatten then the helper, but then emit a call to the helpers since the total amount of code is still large (above inlining threshold).
Middle helper functions may benefit from always_inline in some cases. But it has the same caveat -- if compiler will be forced to inline this function, then it may decide to unline something else instead. So always_inline will need to be applied all way down.

https://github.com/llvm/llvm-project/pull/75800


More information about the libc-commits mailing list