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

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 16:49:19 PDT 2019


xbolva00 added a comment.

There is a comment in TLI:

       // Win32 does not support these functions, but
       // they are generally available on POSIX-compliant systems.
  ...
           TLI.setUnavailable(LibFunc_memccpy);



>> If we're going to start generating memccpy calls, do we need to implement optimizations for it? For example, memccpy of a constant string can be transformed to memcpy.

Yeah, as follow up patch.
snprintf (d, size, "%s", "constant") is handled currently, so we should not regress the current "snprintf" calls with this transform..


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67986





More information about the llvm-commits mailing list