[libc-commits] [PATCH] D77949: [libc] Add SIMD strlen implementation .

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Apr 14 17:25:49 PDT 2020


sivachandra added a comment.

In D77949#1982360 <https://reviews.llvm.org/D77949#1982360>, @hctim wrote:

> In D77949#1982189 <https://reviews.llvm.org/D77949#1982189>, @abrachet wrote:
>
> > We could also make `LLVM_USE_SANITIZER` define a macro so we know when if we are building with any sanitizers and take the slow path in that case. I think it is prohibitively complicated to try to hand write what the compiler can emit for us.
>
>
> This also sounds reasonable to me. It might be worth creating a pattern of having a `_sanitizeable` variant and a "vanilla" variant, and one of the implementations is inlined at compile time. I don't imagine this is the last time this comes up.


In general, we want to avoid having separate instrumented and non-instrumented versions.

In the case of this patch, I think there is only one line that needs special handling at strlen.cpp:51. I would think a static inline helper like `safe_read_word` can be implemented. This function can handle all the sanitizer specific logic as explained by @hctim.

@tschuett, I hope you are not getting the wrong signal here. We want this patch. We are only debating on ways to get it in :)

Also, composing what a compiler should ideally be doing might seem daunting. But again, I think for each such special case, one will find a clear cut point which needs to be handled specially.


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

https://reviews.llvm.org/D77949





More information about the libc-commits mailing list