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