[PATCH] D124633: [SimplifyLibCalls] Pointers passed to libcalls must point to valid objects

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 15:38:37 PDT 2022


xbolva00 added a comment.

In D124633#3481265 <https://reviews.llvm.org/D124633#3481265>, @msebor wrote:

> The C constraint that a pointer argument to a library function must point to an object extends beyond `memcpy` etc. to all standard library functions (unless otherwise specified), including for instance `memchr` or `strncmp`, regardless of the size argument.  (I don't have enough background here to judge if this is something worth exploiting for optimization.)

Right, libcalls with size argument (many tests are updated), memcpy was just example.
IIRC, gcc has knowledge about this fact already and assumes nonnull as well for the purpose of futher optimizations like elimination of redundant null checks after inlining.


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

https://reviews.llvm.org/D124633



More information about the llvm-commits mailing list