[PATCH] D16337: [LibCallSimplifier] fold memset(malloc(x), 0, x) --> calloc(1, x)

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 16:58:37 PST 2016


spatel created this revision.
spatel added reviewers: mcrosier, davide, hfinkel.
spatel added a subscriber: llvm-commits.
Herald added a subscriber: mcrosier.

This is a partial fix for PR25892:
https://llvm.org/bugs/show_bug.cgi?id=25892

It should handle the reported case, but as noted by the 'TODO' comments in the patch, we should also match patterns that include regular memset() and the llvm.memset() intrinsic in addition to memset_chk().

http://reviews.llvm.org/D16337

Files:
  include/llvm/Transforms/Utils/SimplifyLibCalls.h
  lib/CodeGen/CodeGenPrepare.cpp
  lib/Transforms/Utils/SimplifyLibCalls.cpp
  test/Transforms/InstCombine/memset_chk-1.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16337.45327.patch
Type: text/x-patch
Size: 7465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160120/051ba616/attachment.bin>


More information about the llvm-commits mailing list