[all-commits] [llvm/llvm-project] 8d9b9c: [DSE] Handle memcpy/memset with equal non-const si...

Florian Hahn via All-commits all-commits at lists.llvm.org
Wed Mar 10 02:14:54 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8d9b9c0edcebb2ce3723e581be40a9a26300f697
      https://github.com/llvm/llvm-project/commit/8d9b9c0edcebb2ce3723e581be40a9a26300f697
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
    M llvm/test/Transforms/DeadStoreElimination/memory-intrinsics-sizes.ll

  Log Message:
  -----------
  [DSE] Handle memcpy/memset with equal non-const sizes.

Currently DSE misses cases where the size is a non-const IR value, even
if they match. For example, this means that llvm.memcpy/llvm.memset
calls are not eliminated, even if they write the same number of bytes.

This patch extends isOverwite to try to get IR values for the number of
bytes written from the analyzed instructions. If the values match,
alias checks are performed and the result is returned.

At the moment this only covers llvm.memcpy/llvm.memset. In the future,
we may enable MemoryLocation to also track variable sizes, but this
simple approach should allow us to cover the important cases in DSE.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D98284




More information about the All-commits mailing list