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

Dawid Jurczak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 31 04:51:51 PDT 2021


yurai007 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)) &&
----------------
xbolva00 wrote:
> 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
Ok, maybe it would be more accurate than dyn_cast. I need to double check.


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