[PATCH] D67986: [InstCombine] snprintf (d, size, "%s", s) -> memccpy (d, s, '\0', size - 1), d[size - 1] = 0

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 12:40:37 PDT 2019


efriedma added a comment.

> It sounds like memccpy is part of C20. Can we not do this transform unless LangOpt says we're C20 or greater? Otherwise the Linux kernel doesn't implement this routine.

Doesn't the kernel use -fno-builtin?  That should be enough to suppress this optimization.

In general, we assume that TargetLibraryInfo is providing an accurate picture of what functions are available.  If it isn't, we should fix that in some general way.


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

https://reviews.llvm.org/D67986





More information about the llvm-commits mailing list