[llvm] [llvm][SimplifyLibCalls] Add option 'AllowMemcmpToBcmpTransform' (PR #82304)

Clement Courbet via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 01:07:10 PST 2024


legrosbuffle wrote:

> Other than 'llvm libc', major libc implementations (glibc, musl, newlib, uClibc, etc.) either alias bcmp to memcmp, define bcmp as a tail call to memcmp, or don't define bcmp by default. Therefore, the above transformation won't bring benefits to majority of users.

The original plan was to contribute the optimized `bcmp` to `glibc`. What ended up happening is that with the advent of llvm-libc @gchatelet ended up putting the optimized `bcmp` there.

As for this patch I don't think adding an option for every possible nonstandard target extension this is the way to go. As mentioned by @jyknight in https://github.com/llvm/llvm-project/issues/40380, llvm is supposed to be aware of the target environment and emit the appropriate function calls. @gchatelet @nickdesaulniers do we intend on having an llvm-libc target triple ? That would probably be a better long-term solution to support differences between llvm-libc and the glibc.


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


More information about the llvm-commits mailing list