[PATCH] D101176: [SimplifyLibCalls] Transform malloc to calloc with redundant memsets elimination (PR25892)
Dawid Jurczak via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 23 09:17:46 PDT 2021
yurai007 added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:1207
+ // Check AllocBB starting from alloc successor.
+ for (BasicBlock::iterator Scan = ++(Alloc->getIterator()),
+ End = AllocBB->end();
----------------
It's lightweight but very conservative approach. Anyway it's good enough to transform many simple cases (take a look at tests to get idea)
and in particular to satisfy PR case. However we could use alias analysis instead simple scan and in consequence transform more complex scenarios with intermediate store-like instructions. I guess it's feasible but also more intrusive way - keep in in mind currently SimplifyLibCalls knows nothing about AA. Anyway I can go in this direction if you are interested.
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