[PATCH] D47198: [InstCombine] Replace malloc+strcpy with malloc+memcpy

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 22 08:29:44 PDT 2018


xbolva00 created this revision.
xbolva00 added a reviewer: efriedma.
Herald added a subscriber: llvm-commits.

len = strlen(s) + 1;
d = malloc(len);
strcpy(d,s); // ---> memcpy(d,s, len);


Repository:
  rL LLVM

https://reviews.llvm.org/D47198

Files:
  lib/Transforms/Utils/SimplifyLibCalls.cpp
  test/Transforms/InstCombine/malloc-strcpy.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47198.148014.patch
Type: text/x-patch
Size: 7241 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180522/bca914ef/attachment.bin>


More information about the llvm-commits mailing list