[PATCH] D105440: [RFC] Implement support for __builtin_memcmp_inline

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 7 00:48:23 PDT 2021


gchatelet added a comment.

In D105440#2860255 <https://reviews.llvm.org/D105440#2860255>, @efriedma wrote:

> In D105440#2859993 <https://reviews.llvm.org/D105440#2859993>, @gchatelet wrote:
>
>> In D105440#2858438 <https://reviews.llvm.org/D105440#2858438>, @efriedma wrote:
>>
>>> The motivation here seems weaker than it was for memcpy.  memcmp is much less fundamental to LLVM optimizations.  It looks like the primary motivation here is to avoid duplicating the logic in llvm/lib/CodeGen/ExpandMemCmp.cpp ?  But really, it isn't very much target-independent logic, and the only target-specific bit is the heuristic for load widths.
>>
>> I'd rather not duplicate logic in `llvm/lib/CodeGen/ExpandMemCmp.cpp` they may get out of sync.
>
> The problem, from my perspective, is that you'll have to duplicate the logic to some extent anyway.

I see, we'll probably have to extract the shared logic in one or more libraries then.

> Even if __builtin_memcmp_inline is technically available, that doesn't let you access the underlying heuristics, so you'll need special-case logic for every target anyway.

Yes indeed, availability of vector extensions could lead to different algorithms so we need to access target specific logic.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105440/new/

https://reviews.llvm.org/D105440



More information about the llvm-commits mailing list