[PATCH] D45344: [InstCombine] Fold malloc + memset to calloc even for llvm.memset

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 6 11:20:16 PDT 2018


xbolva00 added a comment.

In https://reviews.llvm.org/D45344#1059906, @spatel wrote:

> IIUC, these are 2 independent changes, so they should be split into separate patches:
>
> 1. Handle the memset intrinsic identically to the way we handle the memset libcall. What about memset_chk()?
> 2. Remove the hasOneUse() limitation on the malloc. The reason that's there is discussed in https://reviews.llvm.org/D16337 - the transform must be made safe from intermediate stores. This patch as-is will miscompile that pattern.
>
>   I've added tests at https://reviews.llvm.org/rL329412 and regenerated the check lines. Please fix/limit this patch and rebase.




1. memset_chk change was removed from this commit.
2. https://reviews.llvm.org/D45381


https://reviews.llvm.org/D45344





More information about the llvm-commits mailing list