[clang] [HLSL] Array by-value assignment (PR #109323)
Justin Bogner via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 23 12:38:38 PDT 2024
================
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --enable-var-scope
+
+// CHECK-LABEL: define void {{.*}}arr_assign1
+// CHECK: [[Arr:%.*]] = alloca [2 x i32], align 4
+// CHECK: [[Arr2:%.*]] = alloca [2 x i32], align 4
+// CHECK: [[Tmp:%.*]] = alloca [2 x i32], align 4
+// CHECK: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[Arr]], ptr align 4 {{@.*}}, i32 8, i1 false)
+// CHECK: call void @llvm.memset.p0.i32(ptr align 4 [[Arr2]], i8 0, i32 8, i1 false)
+// CHECK: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[Arr]], ptr align 4 [[Arr2]], i32 8, i1 false)
+// CHECK: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[Tmp]], ptr align 4 [[Arr]], i32 8, i1 false)
----------------
bogner wrote:
> I believe the Tmp exists so 'A = B =C' is possible.
That doesn't seem correct. In the test case with `A = B = C` there is also a Tmp, but it's assigned after all three of A, B, and C
> The problem is in how the codegen is emitting the lvalue.
Ah, so the temporary value here is the (unused) lvalue for the result of the `A = B` expression?
https://github.com/llvm/llvm-project/pull/109323
More information about the cfe-commits
mailing list