yaxunl created this revision.
Herald added subscribers: tpr, dstuttard, nhaehnle, wdng, kzhuravl.

Change constant address space from 4 to 2 for the new address space mapping in 
Clang.


https://reviews.llvm.org/D31771

Files:
  lib/Basic/Targets.cpp
  test/CodeGenOpenCL/address-space-constant-initializers.cl
  test/CodeGenOpenCL/address-spaces.cl
  test/CodeGenOpenCL/amdgpu-env-amdgiz.cl
  test/CodeGenOpenCL/vla.cl

Index: test/CodeGenOpenCL/vla.cl
===================================================================
--- test/CodeGenOpenCL/vla.cl
+++ test/CodeGenOpenCL/vla.cl
@@ -3,13 +3,11 @@
 // RUN: %clang_cc1 -emit-llvm -triple amdgcn-amd-amdhsa-amdgizcl -O0 -cl-std=CL2.0 -o - %s | FileCheck -check-prefixes=CHECK,GIZ %s
 
 constant int sz0 = 5;
-// SPIR: @sz0 = addrspace(2) constant i32 5
-// GIZ: @sz0 = addrspace(4) constant i32 5
+// CHECK: @sz0 = addrspace(2) constant i32 5
 const global int sz1 = 16;
 // CHECK: @sz1 = addrspace(1) constant i32 16
 const constant int sz2 = 8;
-// SPIR: @sz2 = addrspace(2) constant i32 8
-// GIZ: @sz2 = addrspace(4) constant i32 8
+// CHECK: @sz2 = addrspace(2) constant i32 8
 // CHECK: @testvla.vla2 = internal addrspace(3) global [8 x i16] undef
 
 kernel void testvla()
Index: test/CodeGenOpenCL/amdgpu-env-amdgiz.cl
===================================================================
--- test/CodeGenOpenCL/amdgpu-env-amdgiz.cl
+++ test/CodeGenOpenCL/amdgpu-env-amdgiz.cl
@@ -4,6 +4,6 @@
 // RUN: %clang_cc1 %s -O0 -triple amdgcn---amdgizcl -emit-llvm -o - | FileCheck -check-prefix=GIZ %s
 
 // CHECK: target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
-// GIZ: target datalayout = "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-A5"
+// GIZ: target datalayout = "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:32:32-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-A5"
 void foo(void) {}
 
Index: test/CodeGenOpenCL/address-spaces.cl
===================================================================
--- test/CodeGenOpenCL/address-spaces.cl
+++ test/CodeGenOpenCL/address-spaces.cl
@@ -15,8 +15,7 @@
 // CHECK: i32 addrspace(3)* %arg
 void f__l(__local int *arg) {}
 
-// SPIR: i32 addrspace(2)* %arg
-// GIZ: i32 addrspace(4)* %arg
+// CHECK: i32 addrspace(2)* %arg
 void f__c(__constant int *arg) {}
 
 // SPIR: i32* %arg
@@ -29,8 +28,7 @@
 // CHECK: i32 addrspace(3)* %arg
 void fl(local int *arg) {}
 
-// SPIR: i32 addrspace(2)* %arg
-// GIZ: i32 addrspace(4)* %arg
+// CHECK: i32 addrspace(2)* %arg
 void fc(constant int *arg) {}
 
 #ifdef CL20
Index: test/CodeGenOpenCL/address-space-constant-initializers.cl
===================================================================
--- test/CodeGenOpenCL/address-space-constant-initializers.cl
+++ test/CodeGenOpenCL/address-space-constant-initializers.cl
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 %s -ffake-address-space-map -emit-llvm -o - | FileCheck %s
 // RUN: %clang_cc1 %s -triple amdgcn-amd-amdhsa-opencl -emit-llvm -o - | FileCheck %s
-// RUN: %clang_cc1 %s -triple amdgcn-amd-amdhsa-amdgizcl -emit-llvm -o - | FileCheck -check-prefix=GIZ %s
+// RUN: %clang_cc1 %s -triple amdgcn-amd-amdhsa-amdgizcl -emit-llvm -o - | FileCheck %s
 
 typedef struct {
     int i;
@@ -15,8 +15,6 @@
 
 // CHECK: %struct.ConstantArrayPointerStruct = type { float addrspace(2)* }
 // CHECK: addrspace(2) constant %struct.ConstantArrayPointerStruct { float addrspace(2)* bitcast (i8 addrspace(2)* getelementptr (i8, i8 addrspace(2)* bitcast (%struct.ArrayStruct addrspace(2)* @constant_array_struct to i8 addrspace(2)*), i64 4) to float addrspace(2)*) }
-// GIZ: %struct.ConstantArrayPointerStruct = type { float addrspace(4)* }
-// GIZ: addrspace(4) constant %struct.ConstantArrayPointerStruct { float addrspace(4)* bitcast (i8 addrspace(4)* getelementptr (i8, i8 addrspace(4)* bitcast (%struct.ArrayStruct addrspace(4)* @constant_array_struct to i8 addrspace(4)*), i64 4) to float addrspace(4)*) }
 // Bug  18567
 __constant ConstantArrayPointerStruct constant_array_pointer_struct = {
     &constant_array_struct.f
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -2045,10 +2045,10 @@
     0,  // Default
     1,  // opencl_global
     3,  // opencl_local
-    4,  // opencl_constant
+    2,  // opencl_constant
     0,  // opencl_generic
     1,  // cuda_device
-    4,  // cuda_constant
+    2,  // cuda_constant
     3   // cuda_shared
 };
 
@@ -2065,7 +2065,7 @@
   "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64";
 
 static const char *const DataLayoutStringSIGenericIsZero =
-  "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32"
+  "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:32:32-p5:32:32"
   "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128"
   "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-A5";
 
@@ -2080,7 +2080,7 @@
         Generic   = 0;
         Global    = 1;
         Local     = 3;
-        Constant  = 4;
+        Constant  = 2;
         Private   = 5;
       } else {
         Generic   = 4;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to