[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 06:52:39 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:
OK, if it's pre-checked the unreachable before was fine
https://github.com/llvm/llvm-project/pull/100122
More information about the llvm-commits
mailing list