diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index bfab61d3e23d..9db6e327837c 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -750,7 +750,7 @@ static const LangASMap *getAddressSpaceMap(const TargetInfo &T, 1, // sycl_global 3, // sycl_local 2, // sycl_constant - 5, // sycl_private + 0, // sycl_private 4, // sycl_generic }; return &FakeAddrSpaceMap; diff --git a/clang/lib/Basic/Targets/NVPTX.h b/clang/lib/Basic/Targets/NVPTX.h index 3f17b4a16be6..038a6601f0da 100644 --- a/clang/lib/Basic/Targets/NVPTX.h +++ b/clang/lib/Basic/Targets/NVPTX.h @@ -36,7 +36,7 @@ static const unsigned NVPTXAddrSpaceMap[] = { 1, // sycl_global 3, // sycl_local 4, // sycl_constant - 5, // sycl_private + 0, // sycl_private // FIXME: generic has to be added to the target 0, // sycl_generic }; diff --git a/clang/lib/Basic/Targets/SPIR.h b/clang/lib/Basic/Targets/SPIR.h index 905469725ade..6eb129436f33 100644 --- a/clang/lib/Basic/Targets/SPIR.h +++ b/clang/lib/Basic/Targets/SPIR.h @@ -34,7 +34,7 @@ static const unsigned SPIRAddrSpaceMap[] = { 1, // sycl_global 3, // sycl_local 2, // sycl_constant - 5, // sycl_private + 0, // sycl_private 4, // sycl_generic }; diff --git a/clang/lib/Basic/Targets/TCE.h b/clang/lib/Basic/Targets/TCE.h index a912274c2628..b131fe26f9b5 100644 --- a/clang/lib/Basic/Targets/TCE.h +++ b/clang/lib/Basic/Targets/TCE.h @@ -43,7 +43,7 @@ static const unsigned TCEOpenCLAddrSpaceMap[] = { 3, // sycl_global 4, // sycl_local 5, // sycl_constant - 5, // sycl_private + 0, // sycl_private // FIXME: generic has to be added to the target 0, // sycl_generic }; diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 4750c118978e..e38649cd5179 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -5833,7 +5833,7 @@ static bool BuildAddressSpaceIndex(Sema &S, LangAS &ASIdx, return false; } - if (S.LangOpts.SYCLIsDevice && (addrSpace == 4 || addrSpace > 5)) { + if (S.LangOpts.SYCLIsDevice && (addrSpace >= 4)) { S.Diag(AttrLoc, diag::err_sycl_attribute_address_space_invalid) << AddrSpace->getSourceRange(); return false; @@ -5846,7 +5846,7 @@ static bool BuildAddressSpaceIndex(Sema &S, LangAS &ASIdx, ASIdx = [](unsigned AS) { switch (AS) { - case 5: case 0: return LangAS::sycl_private; + case 0: return LangAS::sycl_private; case 1: return LangAS::sycl_global; case 2: return LangAS::sycl_constant; case 3: return LangAS::sycl_local; diff --git a/clang/test/CodeGenSYCL/address-space-parameter-conversions.cpp b/clang/test/CodeGenSYCL/address-space-parameter-conversions.cpp index 702438241039..671f781fc524 100644 --- a/clang/test/CodeGenSYCL/address-space-parameter-conversions.cpp +++ b/clang/test/CodeGenSYCL/address-space-parameter-conversions.cpp @@ -88,11 +88,11 @@ void usages() { void usages2() { __attribute__((address_space(0))) int *PRIV_NUM; - // CHECK-DAG: [[PRIV_NUM:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(5)* - __attribute__((address_space(5))) int *PRIV_NUM2; - // CHECK-DAG: [[PRIV_NUM2:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(5)* + // CHECK-DAG: [[PRIV_NUM:%[a-zA-Z0-9_]+]] = alloca i32* + __attribute__((address_space(0))) int *PRIV_NUM2; + // CHECK-DAG: [[PRIV_NUM2:%[a-zA-Z0-9_]+]] = alloca i32* __private int *PRIV; - // CHECK-DAG: [[PRIV:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(5)* + // CHECK-DAG: [[PRIV:%[a-zA-Z0-9_]+]] = alloca i32* __attribute__((address_space(1))) int *GLOB_NUM; // CHECK-DAG: [[GLOB_NUM:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(1)* __global int *GLOB; @@ -107,17 +107,14 @@ void usages2() { // CHECK-DAG: [[LOCAL:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(3)* bar(*PRIV_NUM); - // CHECK-DAG: [[PRIV_NUM_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(5)*, i32 addrspace(5)** [[PRIV_NUM]] - // CHECK-DAG: [[PRIV_NUM_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(5)* [[PRIV_NUM_LOAD]] to i32 addrspace(4)* - // CHECK-DAG: call spir_func void @new.[[RAW_REF]](i32 addrspace(4)* [[PRIV_NUM_CAST]]) + // CHECK-DAG: [[PRIV_NUM_LOAD:%[a-zA-Z0-9]+]] = load i32*, i32** [[PRIV_NUM]] + // CHECK-DAG: call spir_func void @[[RAW_REF]](i32* dereferenceable(4) [[PRIV_NUM_LOAD]]) bar(*PRIV_NUM2); - // CHECK-DAG: [[PRIV_NUM2_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(5)*, i32 addrspace(5)** [[PRIV_NUM2]] - // CHECK-DAG: [[PRIV_NUM2_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(5)* [[PRIV_NUM2_LOAD]] to i32 addrspace(4)* - // CHECK-DAG: call spir_func void @new.[[RAW_REF]](i32 addrspace(4)* [[PRIV_NUM2_CAST]]) + // CHECK-DAG: [[PRIV_NUM2_LOAD:%[a-zA-Z0-9]+]] = load i32*, i32** [[PRIV_NUM2]] + // CHECK-DAG: call spir_func void @[[RAW_REF]](i32* dereferenceable(4) [[PRIV_NUM2_LOAD]]) bar(*PRIV); - // CHECK-DAG: [[PRIV_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(5)*, i32 addrspace(5)** [[PRIV]] - // CHECK-DAG: [[PRIV_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(5)* [[PRIV_LOAD]] to i32 addrspace(4)* - // CHECK-DAG: call spir_func void @new.[[RAW_REF]](i32 addrspace(4)* [[PRIV_CAST]]) + // CHECK-DAG: [[PRIV_LOAD:%[a-zA-Z0-9]+]] = load i32*, i32** [[PRIV]] + // CHECK-DAG: call spir_func void @[[RAW_REF]](i32* dereferenceable(4) [[PRIV_LOAD]]) bar(*GLOB_NUM); // CHECK-DAG: [[GLOB_NUM_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(1)*, i32 addrspace(1)** [[GLOB_NUM]] // CHECK-DAG: [[GLOB_NUM_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_NUM_LOAD]] to i32 addrspace(4)*