[PATCH] D93360: [LibCallSimplifier] fold memset(malloc(x), 0, x) to calloc(1, x) if memset is intrinsic

Judy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 19:11:42 PST 2020


JudyZhu created this revision.
JudyZhu added a reviewer: spatel.
Herald added a subscriber: hiraditya.
JudyZhu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

this patch want to fix the bug: https://llvm.org/bugs/show_bug.cgi?id=25892

When there is memset in code, llvm might transform memset to llvm.memset.*.
But llvm might not handle this well, so I use this patch to do it.

test:
check-llvm


https://reviews.llvm.org/D93360

Files:
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
  llvm/test/Transforms/InstCombine/memset-1.ll
  llvm/test/Transforms/InstCombine/promot_malloc_and_memset_intrinsic.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93360.312089.patch
Type: text/x-patch
Size: 10082 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201216/7bb46588/attachment.bin>


More information about the llvm-commits mailing list