[PATCH] D50556: [InstCombine] Improve strncpy to memcpy optimization
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 10 02:51:07 PDT 2018
xbolva00 created this revision.
xbolva00 added a reviewer: efriedma.
Herald added a subscriber: llvm-commits.
We optimize
char buf[20];
strncpy(buf, "hi", 3);
puts(buf);
}
to memcpy, but we bail out in the following case:
int f1(void) {
char buf[20];
strncpy(buf, "hi", 4);
puts(buf);
}
Godbolt: https://godbolt.org/g/ganpSH
Repository:
rL LLVM
https://reviews.llvm.org/D50556
Files:
lib/Transforms/Utils/SimplifyLibCalls.cpp
test/Transforms/InstCombine/strncpy-1.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50556.160075.patch
Type: text/x-patch
Size: 5050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180810/25fed895/attachment.bin>
More information about the llvm-commits
mailing list