[llvm] [DirectX] Legalize memcpy (PR #139173)

Greg Roth via llvm-commits llvm-commits at lists.llvm.org
Thu May 15 11:51:40 PDT 2025


================
@@ -0,0 +1,174 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -S -dxil-legalize -dxil-finalize-linkage -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
+
+ at outputStrides = external local_unnamed_addr addrspace(2) global [2 x <4 x i32>], align 4
+
+define void @replace_2x4xint_global_memcpy_test() #0 {
+; CHECK-LABEL: define void @replace_2x4xint_global_memcpy_test(
+; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT:    [[TMP1:%.*]] = alloca [2 x <4 x i32>], align 16
+; CHECK-NEXT:    call void @llvm.lifetime.start.p0(i64 32, ptr nonnull [[TMP1]])
+; CHECK-NEXT:    [[TMP2:%.*]] = load <4 x i32>, ptr addrspace(2) @outputStrides, align 16
+; CHECK-NEXT:    [[GEP:%.*]] = getelementptr <4 x i32>, ptr [[TMP1]], i32 0
+; CHECK-NEXT:    store <4 x i32> [[TMP2]], ptr [[GEP]], align 16
+; CHECK-NEXT:    [[TMP3:%.*]] = load <4 x i32>, ptr addrspace(2) getelementptr (<4 x i32>, ptr addrspace(2) @outputStrides, i32 1), align 16
+; CHECK-NEXT:    [[GEP1:%.*]] = getelementptr <4 x i32>, ptr [[TMP1]], i32 1
+; CHECK-NEXT:    store <4 x i32> [[TMP3]], ptr [[GEP1]], align 16
+; CHECK-NEXT:    call void @llvm.lifetime.end.p0(i64 32, ptr nonnull [[TMP1]])
+; CHECK-NEXT:    ret void
+;
+  %1 = alloca [2 x <4 x i32>], align 16
+  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1)
----------------
pow2clk wrote:

I don't know the tendencies for testing here, but I've taken to removing lifetime markers when I'm not testing them directly. That would simplify some of you CHECK walls of text somewhat. 

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


More information about the llvm-commits mailing list