[PATCH] D101391: [DSE] Eliminate zero memset after calloc

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 14:12:23 PDT 2021


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

LGTM



================
Comment at: llvm/test/Transforms/DeadStoreElimination/noop-stores.ll:415
   %call = tail call i8* @calloc(i64 10000, i64 4)
   call void @llvm.memset.p0i8.i64(i8* %call, i8 %v, i64 40000, i1 false)
   ret i8* %call
----------------
I'd suggest adding a variant that stores a constant but non-zero value (e.g. `i8 1`).

It may also be worthwhile to make sure that passing `i1 true` for the volatile flag will prevent DSE (this should be covered by the isRemovable check in the caller).


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

https://reviews.llvm.org/D101391



More information about the llvm-commits mailing list