[PATCH] D101176: [SimplifyLibCalls] Transform malloc to calloc with redundant memsets elimination (PR25892)

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 7 05:10:54 PDT 2021


xbolva00 added a subscriber: jdoerfert.
xbolva00 added a comment.

Hello, some days ago I was looking at it.

proof of concept code: https://pastebin.com/V8m1v03a

but then I hit same issue as for calloc, you can read about it here: https://reviews.llvm.org/D101440, especially my last comments: https://reviews.llvm.org/D101440#inline-959170

We fails to find def - malloc call, since malloc is marked with inaccessiblememonly. Looks like inaccessiblememonly does not fit well for allocation functions.

Obvious fix is to remove inaccessiblememonly from (m)alloc functions and my POC code should work.. But maybe we could find better solution?

Opinions?

cc @fhahn @nikic @jdoerfert


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101176



More information about the llvm-commits mailing list