[PATCH] D130922: [InstCombine] Add support for stpncpy folding

Martin Sebor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 14:29:01 PDT 2022


msebor updated this revision to Diff 452807.
msebor added a comment.

Changes in revision 1 of the patch include:

- Avoid annotating destination argument when bound is not known to be nonzero.
- Correct `stpncpy` return value to `strnlen(S, N)` rather than `strlen(S)`.
- Simplify common logic .
- Add tests.


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

https://reviews.llvm.org/D130922

Files:
  llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
  llvm/test/Transforms/InstCombine/simplify-libcalls-i16.ll
  llvm/test/Transforms/InstCombine/simplify-libcalls.ll
  llvm/test/Transforms/InstCombine/stpncpy-1.ll
  llvm/test/Transforms/InstCombine/strcpy-nonzero-as.ll
  llvm/test/Transforms/InstCombine/strncpy-1.ll
  llvm/test/Transforms/InstCombine/strncpy-4.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130922.452807.patch
Type: text/x-patch
Size: 44023 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220815/7b0b38c7/attachment.bin>


More information about the llvm-commits mailing list