[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 11:03:53 PST 2022
fhahn updated this revision to Diff 409338.
fhahn added a comment.
In D119929#3326038 <https://reviews.llvm.org/D119929#3326038>, @nikic wrote:
> I'm not sure this is the right approach. The `getDefininingAccess()` here is essentially only supposed to skip over End itself during the clobber walk. As you correctly note, this is not correct if End is a MemoryUse. But shouldn't we be able to still do basically the same thing, but with the previous def in the block? Something like stepping one back on `getReverseDefsIterator()`?
I wasn't aware of the available reverse iterators for defs/accesses. I updated the code to recursively walk over the previous accesses. Because the iterator is block-only, we'd need to also go through the predecessors manually I think which makes it a bit trickier, unless there's already some existing functionaltiy I missed
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.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119929/new/
https://reviews.llvm.org/D119929
Files:
llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
llvm/test/Transforms/MemCpyOpt/memcpy-byval-forwarding-clobbers.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119929.409338.patch
Type: text/x-patch
Size: 6307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220216/60c482a2/attachment.bin>
More information about the llvm-commits
mailing list