[all-commits] [llvm/llvm-project] a8a51f: [DSE] Remove calls with known writes to dead memory

Philip Reames via All-commits all-commits at lists.llvm.org
Fri Dec 17 13:42:53 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a8a51fe55649f5e07f9f2973507dc20bc4e40765
      https://github.com/llvm/llvm-project/commit/a8a51fe55649f5e07f9f2973507dc20bc4e40765
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-12-17 (Fri, 17 Dec 2021)

  Changed paths:
    M llvm/lib/Analysis/MemoryLocation.cpp
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/DeadStoreElimination/trivial-dse-calls.ll

  Log Message:
  -----------
  [DSE] Remove calls with known writes to dead memory

The majority of this change is sinking logic from instcombine into MemoryLocation such that it can be generically reused. If we have a call with a single analyzable write to an argument, we can treat that as-if it were a store of unknown size.

Merging the code in this was unblocks DSE in the store to dead memory code paths. In theory, it should also enable classic DSE of such calls, but the code appears to not know how to use object sizes to refine unknown access bounds (yet).

In addition, this does make the isAllocRemovable path slightly stronger by reusing the libfunc and additional intrinsics bits which are already in getForDest.

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




More information about the All-commits mailing list