Index: cfe/trunk/lib/Basic/Targets.cpp =================================================================== --- cfe/trunk/lib/Basic/Targets.cpp +++ cfe/trunk/lib/Basic/Targets.cpp @@ -2169,15 +2169,20 @@ : DataLayoutStringR600); assert(DataLayout->getAllocaAddrSpace() == AS.Private); - AddrSpaceMap = - llvm::StringSwitch(Triple.getEnvironmentName()) - .Case("opencl", &AMDGPUOpenCLPrivateIsZeroMap) - .Case("amdgiz", &AMDGPUNonOpenCLGenericIsZeroMap) - .Case("amdgizcl", &AMDGPUOpenCLGenericIsZeroMap) - .Default(&AMDGPUNonOpenCLPrivateIsZeroMap); UseAddrSpaceMapMangling = true; } + void adjust(LangOptions &Opts) override { + TargetInfo::adjust(Opts); + if (isGenericZero(getTriple())) { + AddrSpaceMap = Opts.OpenCL ? &AMDGPUOpenCLGenericIsZeroMap + : &AMDGPUNonOpenCLGenericIsZeroMap; + } else { + AddrSpaceMap = Opts.OpenCL ? &AMDGPUOpenCLPrivateIsZeroMap + : &AMDGPUNonOpenCLPrivateIsZeroMap; + } + } + uint64_t getPointerWidthV(unsigned AddrSpace) const override { if (GPU <= GK_CAYMAN) return 32; Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-alignment.cl =================================================================== --- cfe/trunk/test/CodeGenOpenCL/amdgpu-alignment.cl +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-alignment.cl @@ -1,4 +1,5 @@ // REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s // RUN: %clang_cc1 -triple amdgcn-unknown-unknown-opencl -S -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s #pragma OPENCL EXTENSION cl_khr_fp64 : enable Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-debug-info-pointer-address-space.cl =================================================================== --- cfe/trunk/test/CodeGenOpenCL/amdgpu-debug-info-pointer-address-space.cl +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-debug-info-pointer-address-space.cl @@ -1,3 +1,4 @@ +// RUN: %clang -cl-std=CL2.0 -emit-llvm -g -O0 -S -target amdgcn-amd-amdhsa -mcpu=fiji -o - %s | FileCheck %s // RUN: %clang -cl-std=CL2.0 -emit-llvm -g -O0 -S -target amdgcn-amd-amdhsa-opencl -mcpu=fiji -o - %s | FileCheck %s // CHECK-DAG: ![[DWARF_ADDRESS_SPACE_NONE:[0-9]+]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !{{[0-9]+}}, size: {{[0-9]+}}) Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-debug-info-variable-expression.cl =================================================================== --- cfe/trunk/test/CodeGenOpenCL/amdgpu-debug-info-variable-expression.cl +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-debug-info-variable-expression.cl @@ -1,3 +1,4 @@ +// RUN: %clang -cl-std=CL2.0 -emit-llvm -g -O0 -S -target amdgcn-amd-amdhsa -mcpu=fiji -o - %s | FileCheck %s // RUN: %clang -cl-std=CL2.0 -emit-llvm -g -O0 -S -target amdgcn-amd-amdhsa-opencl -mcpu=fiji -o - %s | FileCheck %s // CHECK-DAG: ![[LOCAL:[0-9]+]] = !DIExpression(DW_OP_constu, 2, DW_OP_swap, DW_OP_xderef) Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-nullptr.cl =================================================================== --- cfe/trunk/test/CodeGenOpenCL/amdgpu-nullptr.cl +++ cfe/trunk/test/CodeGenOpenCL/amdgpu-nullptr.cl @@ -1,5 +1,6 @@ +// RUN: %clang_cc1 %s -cl-std=CL2.0 -include opencl-c.h -triple amdgcn -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O0 -cl-std=CL2.0 -include opencl-c.h -triple amdgcn -emit-llvm -o - | FileCheck --check-prefix=NOOPT %s // RUN: %clang_cc1 %s -cl-std=CL2.0 -include opencl-c.h -triple amdgcn---opencl -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 %s -O0 -cl-std=CL2.0 -include opencl-c.h -triple amdgcn---opencl -emit-llvm -o - | FileCheck --check-prefix=NOOPT %s typedef struct { private char *p1; Index: cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl =================================================================== --- cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl +++ cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl @@ -1,4 +1,5 @@ // REQUIRES: amdgpu-registered-target +// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s // RUN: %clang_cc1 -triple amdgcn-unknown-unknown-opencl -S -emit-llvm -o - %s | FileCheck %s #pragma OPENCL EXTENSION cl_khr_fp64 : enable Index: cfe/trunk/test/CodeGenOpenCL/byval.cl =================================================================== --- cfe/trunk/test/CodeGenOpenCL/byval.cl +++ cfe/trunk/test/CodeGenOpenCL/byval.cl @@ -1,3 +1,4 @@ +// RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn %s | FileCheck %s // RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn---opencl %s | FileCheck %s // RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn---amdgizcl %s | FileCheck %s -check-prefix=AMDGIZ Index: cfe/trunk/test/CodeGenOpenCL/size_t.cl =================================================================== --- cfe/trunk/test/CodeGenOpenCL/size_t.cl +++ cfe/trunk/test/CodeGenOpenCL/size_t.cl @@ -1,5 +1,6 @@ // RUN: %clang_cc1 %s -cl-std=CL2.0 -finclude-default-header -emit-llvm -O0 -triple spir-unknown-unknown -o - | FileCheck --check-prefix=SZ32 %s // RUN: %clang_cc1 %s -cl-std=CL2.0 -finclude-default-header -emit-llvm -O0 -triple spir64-unknown-unknown -o - | FileCheck --check-prefix=SZ64 --check-prefix=SZ64ONLY %s +// RUN: %clang_cc1 %s -cl-std=CL2.0 -finclude-default-header -emit-llvm -O0 -triple amdgcn -o - | FileCheck --check-prefix=SZ64 --check-prefix=AMDONLY %s // RUN: %clang_cc1 %s -cl-std=CL2.0 -finclude-default-header -emit-llvm -O0 -triple amdgcn---opencl -o - | FileCheck --check-prefix=SZ64 --check-prefix=AMDONLY %s //SZ32: define{{.*}} i32 @test_ptrtoint_private(i8* %x) Index: cfe/trunk/test/Sema/sizeof-struct-non-zero-as-member.cl =================================================================== --- cfe/trunk/test/Sema/sizeof-struct-non-zero-as-member.cl +++ cfe/trunk/test/Sema/sizeof-struct-non-zero-as-member.cl @@ -1,3 +1,4 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -triple amdgcn -target-cpu verde -S -emit-llvm -o - %s // RUN: %clang_cc1 -verify -fsyntax-only -triple amdgcn--opencl -target-cpu verde -S -emit-llvm -o - %s // expected-no-diagnostics