[llvm-commits] [PATCH] Teach SimplifyLibCalls about stpcpy

David Majnemer david.majnemer at gmail.com
Mon May 14 02:06:17 PDT 2012


On Sun, May 13, 2012 at 4:52 PM, David Majnemer
<david.majnemer at gmail.com> wrote:
> The attached patch converts stpcpy(x, "some_litteral") into a memcpy
> and a GetElementPointer instruction.

I briefly noticed that strcpy(x, x) for arbitrary x is always turned
into a no-op. I figured that stpcpy can easily handle this case if we
are willing to calculate strlen(x); this seems like it should always
be a net win versus going to the library implementation of stpcpy.

-- 
David Majnemer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simplify_stpcpy2.patch
Type: application/octet-stream
Size: 5872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120514/06cd7cbe/attachment.obj>


More information about the llvm-commits mailing list