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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 10:33:30 PDT 2019


lebedev.ri added a comment.

In D67986#1691643 <https://reviews.llvm.org/D67986#1691643>, @nickdesaulniers wrote:

> 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.


LLVM middle-end does not and should not care what (if any) language standard the frontend was targeting when producing the initial IR.
Only the presence (as per `TargetLoweringInfo::has()`) of the replacement builtin matters.


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

https://reviews.llvm.org/D67986





More information about the llvm-commits mailing list