Add __memcmpeq as a LibCall enabled by cl::opt option:
'--with-builtin-memcmpeq'.
If enabled calls to bcmp will be replaced with memcmpeq and calls to
memcmp that only use the result as a boolean will be replaced
with memcmpeq.
If not enabled this patch has no effect.
This is essentially a follow up to: https://reviews.llvm.org/D56593
In glibc we decided against adding an optimized bcmp:
https://marc.info/?t=163157542200002&r=1&w=3
because its not in a reserved namespace.
To get the functionality (and make the bool usage memcmp optimization
meaningful on GNU systems) we added __memcmpeq:
https://sourceware.org/git/?p=glibc.git;a=commit;h=44829b3ddb64e99e37343a0f25b2c082387d31a5
Which was release with GLIBC 2.35.
Unlike bcmp which is an alias to memcmp on all targets in GLIBC,
__memcmpeq is actually better optimized on some targets (x86 as
of writing this patch).