[PATCH] D103009: [DSE] Transform memset + malloc --> calloc (PR25892)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 27 13:25:19 PDT 2021


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1844
+          if (Malloc->getOperand(0) == MemSet->getLength()) {
+            if (DT.dominates(DefUOInst, MemSet) &&
+                memoryIsNotModifiedBetween(Malloc, MemSet, BatchAA, DL, &DT)) {
----------------
It would be clearer to use Malloc instead of DefUOInst here, to match the memoryIsNotModifiedBetween() call.


================
Comment at: llvm/test/Transforms/DeadStoreElimination/noop-stores.ll:3
 ; RUN: opt < %s -basic-aa -dse -S | FileCheck %s
 ; RUN: opt < %s -aa-pipeline=basic-aa -passes=dse -S | FileCheck %s
 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
----------------
Please change this RUN line to use `-passes='dse,verify<memoryssa>'`.


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