[PATCH] D103009: [DSE] Transform memset + malloc --> calloc (PR25892)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 20 01:56:46 PDT 2021


lebedev.ri added a comment.

In D103009#2956871 <https://reviews.llvm.org/D103009#2956871>, @yurai007 wrote:

>> I found and reduced a test case that shows a too eager replacement of malloc with calloc: https://gcc.godbolt.org/z/dTjonof74
>> (...) This is quite a serious problem. Would you please revert while working on a fix?
>
> First of all just to make it clear - in this particular case GCC does exactly same: https://gcc.godbolt.org/z/qbE6Kxdnv unless you pass different flags.

I will be blunt: i do not understand what are the profitability heuristics for this transform are?
When is `calloc` better than a `malloc` immediately followed by the `memset`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103009/new/

https://reviews.llvm.org/D103009



More information about the llvm-commits mailing list