[PATCH] D103009: [DSE] Eliminate memset after malloc

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 28 08:51:45 PDT 2021


xbolva00 added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1801
+            cast<CallBase>(DefUOInst)->getOperand(0) == MemSet->getLength()) {
+          auto *Malloc = cast<CallInst>(DefUOInst);
+          if (DT.dominates(DefUOInst, cast<Instruction>(MemSet)) &&
----------------
yurai007 wrote:
> That's root cause of some crashes. Cannot assume that isMallocLikeFn imply malloc. Will fix.
https://llvm.org/doxygen/MemoryBuiltins_8cpp_source.html

So: isMallocLikeFn && !isOpNewLikeFn


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