[PATCH] D74444: [NVPTX, LSV] Move the LSV optimization pass to later when the graph is cleaner

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 12:24:48 PST 2020


tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

Minor test nits. LGTM otherwise.
I'm curious, what does generated ptx for the function look before/after the patch.



================
Comment at: llvm/test/CodeGen/NVPTX/vector-loads.ll:73
+define void @foo_complex(i8* nocapture readonly align 16 dereferenceable(134217728) %alloc0) {
+; CHECK: .func foo_complex
+; CHECK: ld.v2.u8
----------------
CHECK-LABEL


================
Comment at: llvm/test/CodeGen/NVPTX/vector-loads.ll:75
+; CHECK: ld.v2.u8
+; CHECK-NOT: ld
+; CHECK: ret
----------------
I'm not sure we need it. The check above verifies that the load did get vectorized, which was the purpose of this patch and the test.

Any condition when CHECK-NOT may fail (e.g. we're loading more than one, or it's an unrelated load/store) is unlikely to be relevant. It will also only look in-between `ld.v2.u8` and `ret`, and such issues will not be detected before `ld.v2.u8`. If you want to ensure that `ld.v2.u8` is the only relevant load, then you may need to have a separate test case which would fail if it's found more than one `ld` of any kind. Or you can add another `CHECK-NOT: ld` between the start of the function and `CHECK: ld.v2.u8`. I think that may work, but I'm not completely sure.

I'd just skip CHECK-NOT altogether.




================
Comment at: llvm/test/CodeGen/NVPTX/vector-loads.ll:92
+  %t27 = getelementptr inbounds [1024 x [131072 x i8]], [1024 x [131072 x i8]]* %targ0.1.typed, i64 0, i64 %t20, i64 %t9
+  %t28 = load i8, i8* %t27, align 2
+  %t31 = getelementptr inbounds [1024 x [131072 x i8]], [1024 x [131072 x i8]]* %targ0.1.typed, i64 0, i64 %t20, i64 %t11
----------------
CHECK:  ld.v2.u8



================
Comment at: llvm/test/CodeGen/NVPTX/vector-loads.ll:98
+  store i8 %t34, i8* %t31
+  ret void
+}
----------------
CHECK: ret


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74444/new/

https://reviews.llvm.org/D74444





More information about the llvm-commits mailing list