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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 19 01:48:00 PST 2022


nikic added a comment.

> I think we also need to do that for MemoryDefs, if End doesn't clobber Loc, because then the defining access could be optimized by skipping any accesses to Loc unless I am missing something.

Unlike MemoryUses, MemoryDefs have a separate defining access and optimized access. The defining access always points to the dominating MemoryDef/MemoryPhi, regardless of whether it clobbers any locations of the access. The optimized access does take clobbers into account.

If you are looking for a quick fix here, then the way to do it is to use the code as-is for MemoryDefs and only limit to the single-BB walk for MemoryUses. That should fix the issue with readonly byval calls, while keeping the much more important memcpy-memcpy dependence optimization working as before.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119929/new/

https://reviews.llvm.org/D119929



More information about the llvm-commits mailing list