Skip to content

Commit 11e103b

Browse files
committed
[NVPTX] Allow MemTransferInst in adjustByValArgAlignment
Before b7b28e7, AreSupportedUsers will skip MemTransferInst. In b7b28e7, we start to allow MemTransferInst, we should allow it in adjustByValArgAlignment too.
1 parent 6d13cc9 commit 11e103b

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,9 @@ static void adjustByValArgAlignment(Argument *Arg, Value *ArgInParamAS,
435435
continue;
436436
}
437437

438+
if (isa<MemTransferInst>(CurUser))
439+
continue;
440+
438441
// supported for grid_constant
439442
if (IsGridConstant &&
440443
(isa<CallInst>(CurUser) || isa<StoreInst>(CurUser) ||

llvm/test/CodeGen/NVPTX/lower-byval-args.ll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,20 @@ entry:
219219
ret void
220220
}
221221

222+
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
223+
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 {
224+
; COMMON-LABEL: define dso_local void @memcpy_from_param_noalign(
225+
; COMMON-SAME: ptr nocapture noundef writeonly [[OUT:%.*]], ptr nocapture noundef readonly byval([[STRUCT_S:%.*]]) align 4 [[S:%.*]]) local_unnamed_addr #[[ATTR0]] {
226+
; COMMON-NEXT: [[ENTRY:.*:]]
227+
; COMMON-NEXT: [[S1:%.*]] = addrspacecast ptr [[S]] to ptr addrspace(101)
228+
; COMMON-NEXT: call void @llvm.memcpy.p0.p101.i64(ptr [[OUT]], ptr addrspace(101) [[S1]], i64 16, i1 true)
229+
; COMMON-NEXT: ret void
230+
;
231+
entry:
232+
tail call void @llvm.memcpy.p0.p0.i64(ptr %out, ptr %s, i64 16, i1 true)
233+
ret void
234+
}
235+
222236
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
223237
define dso_local void @memcpy_to_param(ptr nocapture noundef readonly %in, ptr nocapture noundef readnone byval(%struct.S) align 4 %s) local_unnamed_addr #0 {
224238
; COMMON-LABEL: define dso_local void @memcpy_to_param(

0 commit comments

Comments
 (0)