[all-commits] [llvm/llvm-project] a5c3b5: [MemCpyOpt] Work around PR54682

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Apr 4 01:21:46 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a5c3b5748c1176c11bdc041271ead5392295742d
      https://github.com/llvm/llvm-project/commit/a5c3b5748c1176c11bdc041271ead5392295742d
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-04-04 (Mon, 04 Apr 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
    M llvm/test/Transforms/MemCpyOpt/pr54682.ll

  Log Message:
  -----------
  [MemCpyOpt] Work around PR54682

As discussed on https://github.com/llvm/llvm-project/issues/54682,
MemorySSA currently has a bug when computing the clobber of calls
that access loop-varying locations. I think a "proper" fix for this
on the MemorySSA side might be non-trivial, but we can easily work
around this in MemCpyOpt:

Currently, MemCpyOpt uses a location-less getClobberingMemoryAccess()
call to find a clobber on either the src or dest location, and then
refines it for the src and dest clobber. This was intended as an
optimization, as the location-less API is cached, while the
location-affected APIs are not.

However, I don't think this really makes a difference in practice,
because I don't think anything will use the cached clobbers on
those calls later anyway. On CTMark, this patch seems to be very
mildly positive actually.

So I think this is a reasonable way to avoid the problem for now,
though MemorySSA should also get a fix.

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




More information about the All-commits mailing list