[llvm] [AMDGPU] Handle memcpy()-like ops in LowerBufferFatPointers (PR #126621)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 03:50:21 PST 2025


================
@@ -597,6 +622,47 @@ bool StoreFatPtrsAsIntsVisitor::visitStoreInst(StoreInst &SI) {
   return true;
 }
 
+bool StoreFatPtrsAsIntsAndExpandMemcpyVisitor::visitMemCpyInst(
+    MemCpyInst &MCI) {
+  // TODO: Allow memcpy.p7.p3 as a synonym for the direct-to-LDS copy, which'll
+  // need loop expansion here.
+  if (MCI.getSourceAddressSpace() != AMDGPUAS::BUFFER_FAT_POINTER &&
+      MCI.getDestAddressSpace() != AMDGPUAS::BUFFER_FAT_POINTER)
+    return false;
+  llvm::expandMemCpyAsLoop(&MCI,
+                           TM->getTargetTransformInfo(*MCI.getFunction()));
----------------
arsenm wrote:

I'd expect this pass to just adjust the operands of the intrinsic, and not directly expand to loop

https://github.com/llvm/llvm-project/pull/126621


More information about the llvm-commits mailing list