[all-commits] [llvm/llvm-project] 17db12: [MemCpyOpt] Optimize MemoryDef insertion

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Aug 10 12:28:46 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 17db125b487faa69d789b80d47b19da49522b168
      https://github.com/llvm/llvm-project/commit/17db125b487faa69d789b80d47b19da49522b168
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-08-10 (Tue, 10 Aug 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp

  Log Message:
  -----------
  [MemCpyOpt] Optimize MemoryDef insertion

When converting a store into a memset, we currently insert the new
MemoryDef after the store MemoryDef, which requires all uses to be
renamed to the new def using a whole block scan. Instead, we can
insert the new MemoryDef before the store and not rename uses,
because we know that the location is immediately overwritten, so
all uses should still refer to the old MemoryDef. Those uses will
get renamed when the old MemoryDef is actually dropped, which is
efficient.

I expect something similar can be done for some of the other MSSA
updates in MemCpyOpt. This is an alternative to D107513, at least
for this particular case.

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




More information about the All-commits mailing list