1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -O0 -triple amdgcn---amdgiz -emit-llvm %s -o - | FileCheck %s
4 // CHECK-LABEL: @_Z5func1Pi(
6 // CHECK-NEXT: [[X_ADDR:%.*]] = alloca ptr, align 8, addrspace(5)
7 // CHECK-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X_ADDR]] to ptr
8 // CHECK-NEXT: store ptr [[X:%.*]], ptr [[X_ADDR_ASCAST]], align 8
9 // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[X_ADDR_ASCAST]], align 8
10 // CHECK-NEXT: store i32 1, ptr [[TMP0]], align 4
11 // CHECK-NEXT: ret void
17 // CHECK-LABEL: @_Z5func2v(
19 // CHECK-NEXT: [[LV1:%.*]] = alloca i32, align 4, addrspace(5)
20 // CHECK-NEXT: [[LV2:%.*]] = alloca i32, align 4, addrspace(5)
21 // CHECK-NEXT: [[LA:%.*]] = alloca [100 x i32], align 4, addrspace(5)
22 // CHECK-NEXT: [[LP1:%.*]] = alloca ptr, align 8, addrspace(5)
23 // CHECK-NEXT: [[LP2:%.*]] = alloca ptr, align 8, addrspace(5)
24 // CHECK-NEXT: [[LVC:%.*]] = alloca i32, align 4, addrspace(5)
25 // CHECK-NEXT: [[LV1_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[LV1]] to ptr
26 // CHECK-NEXT: [[LV2_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[LV2]] to ptr
27 // CHECK-NEXT: [[LA_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[LA]] to ptr
28 // CHECK-NEXT: [[LP1_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[LP1]] to ptr
29 // CHECK-NEXT: [[LP2_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[LP2]] to ptr
30 // CHECK-NEXT: [[LVC_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[LVC]] to ptr
31 // CHECK-NEXT: store i32 1, ptr [[LV1_ASCAST]], align 4
32 // CHECK-NEXT: store i32 2, ptr [[LV2_ASCAST]], align 4
33 // CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [100 x i32], ptr [[LA_ASCAST]], i64 0, i64 0
34 // CHECK-NEXT: store i32 3, ptr [[ARRAYIDX]], align 4
35 // CHECK-NEXT: store ptr [[LV1_ASCAST]], ptr [[LP1_ASCAST]], align 8
36 // CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [100 x i32], ptr [[LA_ASCAST]], i64 0, i64 0
37 // CHECK-NEXT: store ptr [[ARRAYDECAY]], ptr [[LP2_ASCAST]], align 8
38 // CHECK-NEXT: call void @_Z5func1Pi(ptr noundef [[LV1_ASCAST]])
39 // CHECK-NEXT: store i32 4, ptr [[LVC_ASCAST]], align 4
40 // CHECK-NEXT: store i32 4, ptr [[LV1_ASCAST]], align 4
41 // CHECK-NEXT: ret void
73 // CHECK-LABEL: @_Z5func3v(
75 // CHECK-NEXT: [[A:%.*]] = alloca [[CLASS_A:%.*]], align 4, addrspace(5)
76 // CHECK-NEXT: [[A_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[A]] to ptr
77 // CHECK-NEXT: call void @_ZN1AC1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[A_ASCAST]])
78 // CHECK-NEXT: call void @_ZN1AD1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[A_ASCAST]])
79 // CHECK-NEXT: ret void
85 // CHECK-LABEL: @_Z5func4i(
87 // CHECK-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4, addrspace(5)
88 // CHECK-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X_ADDR]] to ptr
89 // CHECK-NEXT: store i32 [[X:%.*]], ptr [[X_ADDR_ASCAST]], align 4
90 // CHECK-NEXT: call void @_Z5func1Pi(ptr noundef [[X_ADDR_ASCAST]])
91 // CHECK-NEXT: ret void
97 // CHECK-LABEL: @_Z5func5v(
99 // CHECK-NEXT: [[X:%.*]] = alloca i32, align 4, addrspace(5)
100 // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X]] to ptr
101 // CHECK-NEXT: ret void
108 // CHECK-LABEL: @_Z5func6v(
109 // CHECK-NEXT: entry:
110 // CHECK-NEXT: [[X:%.*]] = alloca i32, align 4, addrspace(5)
111 // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X]] to ptr
112 // CHECK-NEXT: ret void
119 extern void use(int *);
120 // CHECK-LABEL: @_Z5func7v(
121 // CHECK-NEXT: entry:
122 // CHECK-NEXT: [[X:%.*]] = alloca i32, align 4, addrspace(5)
123 // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X]] to ptr
124 // CHECK-NEXT: br label [[LATER:%.*]]
126 // CHECK-NEXT: call void @_Z3usePi(ptr noundef [[X_ASCAST]])
127 // CHECK-NEXT: ret void