[llvm] [LowerMemIntrinsics] Lower llvm.memmove to wide memory accesses (PR #100122)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 25 04:54:42 PDT 2024
================
@@ -434,18 +455,8 @@ static void createMemMoveLoopUnknownSize(Instruction *InsertBefore,
// If the pointers are in different address spaces, they need to be converted
// to a compatible one. Cases where memory ranges in the different address
// spaces cannot overlap are lowered as memcpy and not handled here.
- Value *CmpSrcAddr = SrcAddr;
- Value *CmpDstAddr = DstAddr;
- if ((SrcAS != DstAS)) {
- if (TTI.isValidAddrSpaceCast(DstAS, SrcAS)) {
- CmpDstAddr = PLBuilder.CreateAddrSpaceCast(DstAddr, SrcAddr->getType());
- } else if (TTI.isValidAddrSpaceCast(SrcAS, DstAS)) {
- CmpSrcAddr = PLBuilder.CreateAddrSpaceCast(SrcAddr, DstAddr->getType());
- } else {
- llvm_unreachable("Can only lower memmove between address spaces if they "
- "support addrspacecast");
- }
- }
+ auto [CmpSrcAddr, CmpDstAddr] =
+ tryInsertCastToCommonAddrSpace(PLBuilder, SrcAddr, DstAddr, TTI);
----------------
arsenm wrote:
I don't see how this bails out if the cast isn't possible. It will go ahead to create the invalid compare with different pointer types?
https://github.com/llvm/llvm-project/pull/100122
More information about the llvm-commits
mailing list