[llvm] Support non-malloc functions in malloc+memset->calloc fold (PR #138299)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 2 19:02:35 PDT 2025


clubby789 wrote:

> I think it is worth it because there are some programs out there that use xmalloc and it might be useful to optimize that to xcalloc.

Sorry, I'm not sure I understand this. I think the original question is about extending the system to be smart enough to transform `alloc(size)` to `calloc(1, size)`. Whereas `xmalloc`->`xcalloc` can be easily done by a frontend, and just requires adding `"alloc-variant-zeroed"="xcalloc"` to `xmalloc`.

https://github.com/llvm/llvm-project/pull/138299


More information about the llvm-commits mailing list