1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -emit-llvm -disable-llvm-passes -o - -hlsl-entry main %s | FileCheck %s
\r
8 Pair Another = {5, 10};
\r
19 [numthreads(1, 1, 1)]
\r
21 Pair Vals = {1, 2.0};
\r
22 Vals.First = Vals.getFirst();
\r
23 Vals.Second = Vals.getSecond();
\r
26 // This tests reference like implicit this in HLSL
\r
27 // CHECK: define linkonce_odr noundef i32 @"?getFirst@Pair@@QAAHXZ"(ptr noundef nonnull align 4 dereferenceable(8) %this) #3 align 2 {
\r
28 // CHECK-NEXT:entry:
\r
29 // CHECK-NEXT:%this.addr = alloca ptr, align 4
\r
30 // CHECK-NEXT:%Another = alloca %struct.Pair, align 4
\r
31 // CHECK-NEXT:store ptr %this, ptr %this.addr, align 4
\r
32 // CHECK-NEXT:%this1 = load ptr, ptr %this.addr, align 4
\r
33 // CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 %Another, ptr align 4 @"__const.?getFirst@Pair@@QAAHXZ.Another", i32 8, i1 false)
\r
34 // CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 %this1, ptr align 4 %Another, i32 8, i1 false)
\r
35 // CHECK-NEXT:%First = getelementptr inbounds %struct.Pair, ptr %this1, i32 0, i32 0
\r
37 // CHECK: define linkonce_odr noundef i32 @"?getSecond@Pair@@QAAHXZ"(ptr noundef nonnull align 4 dereferenceable(8) %this) #3 align 2 {
\r
38 // CHECK-NEXT:entry:
\r
39 // CHECK-NEXT:%this.addr = alloca ptr, align 4
\r
40 // CHECK-NEXT:%ref.tmp = alloca %struct.Pair, align 4
\r
41 // CHECK-NEXT:store ptr %this, ptr %this.addr, align 4
\r
42 // CHECK-NEXT:%this1 = load ptr, ptr %this.addr, align 4
\r
43 // CHECK-NEXT:call void @llvm.memset.p0.i32(ptr align 4 %ref.tmp, i8 0, i32 8, i1 false)
\r
44 // CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 %this1, ptr align 4 %ref.tmp, i32 8, i1 false)
\r
45 // CHECK-NEXT:%Second = getelementptr inbounds %struct.Pair, ptr %this1, i32 0, i32 1
\r