This is an archive of the discontinued LLVM Phabricator instance.

LowerMemIntrinsics: Check address space aliasing for memmove expansion
ClosedPublic

Authored by arsenm on Jun 12 2023, 4:40 AM.

Details

Summary

For cases where we cannot insert an addrspacecast, we can still expand
like a memcpy if we know the address spaces cannot alias. Normally
non-aliasing memmoves are optimized to memcpy, but we cannot rely on
that for lowering. If a target has aliasing address spaces that cannot
be casted between, we still have to give up lowering this.

Diff Detail

Event Timeline

arsenm created this revision.Jun 12 2023, 4:40 AM
arsenm requested review of this revision.Jun 12 2023, 4:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 12 2023, 4:40 AM
Herald added a subscriber: wdng. · View Herald Transcript
tra accepted this revision.Jun 12 2023, 11:20 AM

LGTM in principle.

llvm/lib/Transforms/Utils/LowerMemIntrinsics.cpp
401–410

Nit: The comments matching the variable names don't look particularly useful. I'd remove most of leam, maybe leaving the CanOverlap.

This revision is now accepted and ready to land.Jun 12 2023, 11:20 AM
ebrevnov added inline comments.Jun 12 2023, 10:06 PM
llvm/lib/Transforms/Utils/LowerMemIntrinsics.cpp
396

I would suggest to move this peace of code to the caller to preserve logical structure of the code (createMemMoveLoop suggest to create a mem move not mem copy). Not insisting though...

433

Should the comment be updated?

arsenm closed this revision.Jun 14 2023, 4:57 AM
arsenm marked 2 inline comments as done.
llvm/lib/Transforms/Utils/LowerMemIntrinsics.cpp
401–410

I just copy-pasted from the other place here that does this