Skip to content

Commit

Permalink
[SCYL] Revert SYCL __private address space value to 0.
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Lazarev <vladimir.lazarev@intel.com>
Signed-off-by: Alexey Voronov <alexey.voronov@intel.com>
  • Loading branch information
alexeyvoronov-intel authored and vladimirlaz committed Mar 22, 2019
1 parent f0d1636 commit 873ad55
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Basic/Targets/NVPTX.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Basic/Targets/SPIR.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Basic/Targets/TCE.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
23 changes: 10 additions & 13 deletions clang/test/CodeGenSYCL/address-space-parameter-conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)*
Expand Down

0 comments on commit 873ad55

Please sign in to comment.