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

Dawid Jurczak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 20 02:07:35 PDT 2021


yurai007 added a comment.

> 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`?

IIRC the main rationale behind this transformation is here: https://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc. 
I think I could prepare benchmark showing benefits of calloc over malloc+memset, I already observed reduced RSS and less page faults after transformation on some tests. 
However if non-standard malloc is used it may behave differently.


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