[PATCH] D130666: [InstCombine] Add support for strlcpy folding
Martin Sebor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 27 14:54:49 PDT 2022
msebor created this revision.
msebor added reviewers: xbolva00, nikic, efriedma.
Herald added a subscriber: hiraditya.
Herald added a project: All.
msebor requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The middle end support for `strlcpy` consists of transforming calls to `__strlcpy_chk` to the function itself if the buffer overflow checking overhead can be avoided. This change extends the support to also optimize a subset of calls to the function itself, similar to `snprintf`.
The `strlcpy` and `strlcat` functions have both recently been added to the next revision of POSIX (see issue 986 <https://www.austingroupbugs.net/view.php?id=986>). If/when this proposed enhancement is accepted I'll look into adding minimal support for `strlcat` as well.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D130666
Files:
llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/test/Transforms/InstCombine/fortify-folding.ll
llvm/test/Transforms/InstCombine/strlcpy-1.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130666.448153.patch
Type: text/x-patch
Size: 21465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220727/c3722e49/attachment.bin>
More information about the llvm-commits
mailing list