[PATCH] D119929: [MemCpyOpt] Check uses of found Clobber in writtenBetween.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 16 03:39:47 PST 2022


fhahn created this revision.
fhahn added reviewers: asbirlea, nikic, reames.
Herald added a subscriber: hiraditya.
fhahn requested review of this revision.
Herald added a project: LLVM.

Currently writtenBetween can miss clobbers of Loc between End and Clobber
if Loc is not clobbered by End itself. End's defining accesses only have
to contain defs/phis that may clobber memory clobbered by End. But
writtenBetween needs to check for all write-clobbers of Loc.

To guarantee we see all write clobbers of Loc between the found Clobber
and End, I think we have to look at all uses of Clobber between Clobber
and End.

This fixes 2 mis-compiles illustrated in
llvm/test/Transforms/MemCpyOpt/memcpy-byval-forwarding-clobbers.ll

The implementation in this patch may consider write-clobbers on paths
that do not reach End as writes between Clobber and End. There's
potential to improve this as follow-up.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119929

Files:
  llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
  llvm/test/Transforms/MemCpyOpt/memcpy-byval-forwarding-clobbers.ll
  llvm/test/Transforms/MemCpyOpt/nonlocal-memcpy-memcpy.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119929.409199.patch
Type: text/x-patch
Size: 5342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220216/ae7fc5cb/attachment.bin>


More information about the llvm-commits mailing list