Skip to content

Commit dd38b77

Browse files
committed
address comments
1 parent 0c992e6 commit dd38b77

File tree

1 file changed

+13
-38
lines changed

1 file changed

+13
-38
lines changed

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

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -98,44 +98,19 @@ entry:
9898
ret void
9999
}
100100

101-
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
102-
define dso_local ptx_kernel void @read_only_gep_asc(ptr nocapture noundef writeonly %out, ptr nocapture noundef readonly byval(%struct.S) align 4 %s) local_unnamed_addr #0 {
103-
; LOWER-ARGS-LABEL: define dso_local ptx_kernel void @read_only_gep_asc(
104-
; LOWER-ARGS-SAME: ptr noundef writeonly captures(none) [[OUT:%.*]], ptr noundef readonly byval([[STRUCT_S:%.*]]) align 4 captures(none) [[S:%.*]]) local_unnamed_addr #[[ATTR0]] {
105-
; LOWER-ARGS-NEXT: [[ENTRY:.*:]]
106-
; LOWER-ARGS-NEXT: [[S3:%.*]] = call ptr addrspace(101) @llvm.nvvm.internal.addrspace.wrap.p101.p0(ptr [[S]])
107-
; LOWER-ARGS-NEXT: [[B4:%.*]] = getelementptr inbounds i8, ptr addrspace(101) [[S3]], i64 4
108-
; LOWER-ARGS-NEXT: [[I:%.*]] = load i32, ptr addrspace(101) [[B4]], align 4
109-
; LOWER-ARGS-NEXT: store i32 [[I]], ptr [[OUT]], align 4
110-
; LOWER-ARGS-NEXT: ret void
111-
;
112-
; COPY-LABEL: define dso_local ptx_kernel void @read_only_gep_asc(
113-
; COPY-SAME: ptr noundef writeonly captures(none) [[OUT:%.*]], ptr noundef readonly byval([[STRUCT_S:%.*]]) align 4 captures(none) [[S:%.*]]) local_unnamed_addr #[[ATTR0]] {
114-
; COPY-NEXT: [[ENTRY:.*:]]
115-
; COPY-NEXT: [[B:%.*]] = getelementptr inbounds nuw i8, ptr [[S]], i64 4
116-
; COPY-NEXT: [[ASC:%.*]] = addrspacecast ptr [[B]] to ptr addrspace(101)
117-
; COPY-NEXT: [[I:%.*]] = load i32, ptr addrspace(101) [[ASC]], align 4
118-
; COPY-NEXT: store i32 [[I]], ptr [[OUT]], align 4
119-
; COPY-NEXT: ret void
120-
;
121-
; PTX-LABEL: read_only_gep_asc(
122-
; PTX: {
123-
; PTX-NEXT: .reg .b32 %r<2>;
124-
; PTX-NEXT: .reg .b64 %rd<3>;
125-
; PTX-EMPTY:
126-
; PTX-NEXT: // %bb.0: // %entry
127-
; PTX-NEXT: ld.param.u64 %rd1, [read_only_gep_asc_param_0];
128-
; PTX-NEXT: cvta.to.global.u64 %rd2, %rd1;
129-
; PTX-NEXT: ld.param.u32 %r1, [read_only_gep_asc_param_1+4];
130-
; PTX-NEXT: st.global.u32 [%rd2], %r1;
131-
; PTX-NEXT: ret;
132-
entry:
133-
%b = getelementptr inbounds nuw i8, ptr %s, i64 4
134-
%asc = addrspacecast ptr %b to ptr addrspace(101)
135-
%i = load i32, ptr addrspace(101) %asc, align 4
136-
store i32 %i, ptr %out, align 4
137-
ret void
138-
}
101+
;; TODO: This test has been disabled because the addrspacecast is not legal on
102+
;; sm_60, and not well supported within nvptx-lower-args. We should determine
103+
;; in what cases it is safe to make assumptions about the address of a byval
104+
;; parameter and improve our handling of addrspacecast in nvptx-lower-args.
105+
106+
; define dso_local ptx_kernel void @read_only_gep_asc(ptr nocapture noundef writeonly %out, ptr nocapture noundef readonly byval(%struct.S) align 4 %s) local_unnamed_addr #0 {
107+
; entry:
108+
; %b = getelementptr inbounds nuw i8, ptr %s, i64 4
109+
; %asc = addrspacecast ptr %b to ptr addrspace(101)
110+
; %i = load i32, ptr addrspace(101) %asc, align 4
111+
; store i32 %i, ptr %out, align 4
112+
; ret void
113+
; }
139114

140115
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
141116
define dso_local ptx_kernel void @read_only_gep_asc0(ptr nocapture noundef writeonly %out, ptr nocapture noundef readonly byval(%struct.S) align 4 %s) local_unnamed_addr #0 {

0 commit comments

Comments
 (0)