1; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -infer-address-spaces -o - %s | FileCheck %s 2 3@c0 = addrspace(4) global float* undef 4 5; CHECK-LABEL: @generic_ptr_from_constant 6; CHECK: addrspacecast float* %p to float addrspace(1)* 7; CHECK-NEXT: load float, float addrspace(1)* 8define float @generic_ptr_from_constant() { 9 %p = load float*, float* addrspace(4)* @c0 10 %v = load float, float* %p 11 ret float %v 12} 13 14%struct.S = type { i32*, float* } 15 16; CHECK-LABEL: @generic_ptr_from_aggregate_argument 17; CHECK: addrspacecast i32* %p0 to i32 addrspace(1)* 18; CHECK: addrspacecast float* %p1 to float addrspace(1)* 19; CHECK: load i32, i32 addrspace(1)* 20; CHECK: store float %v1, float addrspace(1)* 21; CHECK: ret 22define amdgpu_kernel void @generic_ptr_from_aggregate_argument(%struct.S addrspace(4)* byref(%struct.S) align 8 %0) { 23 %f0 = getelementptr inbounds %struct.S, %struct.S addrspace(4)* %0, i64 0, i32 0 24 %p0 = load i32*, i32* addrspace(4)* %f0 25 %f1 = getelementptr inbounds %struct.S, %struct.S addrspace(4)* %0, i64 0, i32 1 26 %p1 = load float*, float* addrspace(4)* %f1 27 %v0 = load i32, i32* %p0 28 %v1 = sitofp i32 %v0 to float 29 store float %v1, float* %p1 30 ret void 31} 32