[llvm] [NVPTX] Allow MemTransferInst in adjustByValArgAlignment (PR #112462)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 11:18:16 PDT 2024


================
@@ -219,6 +219,20 @@ entry:
   ret void
 }
 
+; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
+define dso_local void @memcpy_from_param_noalign (ptr nocapture noundef writeonly %out, ptr nocapture noundef readonly byval(%struct.S) %s) local_unnamed_addr #0 {
+; COMMON-LABEL: define dso_local void @memcpy_from_param_noalign(
+; COMMON-SAME: ptr nocapture noundef writeonly [[OUT:%.*]], ptr nocapture noundef readonly byval([[STRUCT_S:%.*]]) align 4 [[S:%.*]]) local_unnamed_addr #[[ATTR0]] {
+; COMMON-NEXT:  [[ENTRY:.*:]]
+; COMMON-NEXT:    [[S1:%.*]] = addrspacecast ptr [[S]] to ptr addrspace(101)
+; COMMON-NEXT:    call void @llvm.memcpy.p0.p101.i64(ptr [[OUT]], ptr addrspace(101) [[S1]], i64 16, i1 true)
----------------
Artem-B wrote:

This appears to be the same output LLVM produces now: https://godbolt.org/z/sbr3hbGsc

```
define dso_local void @memcpy_from_param_noalign(ptr nocapture noundef writeonly %out, ptr nocapture noundef readonly byval(%struct.S) align 4 %s) local_unnamed_addr #0 {
entry:
  %s1 = addrspacecast ptr %s to ptr addrspace(101)
  call void @llvm.memcpy.p0.p101.i64(ptr %out, ptr addrspace(101) %s1, i64 16, i1 true)
  ret void
}
```

Can you update the test so it demonstrates the behavior the patch is intended to fix?

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


More information about the llvm-commits mailing list