[PATCH] D32133: CodeGen: Let byval parameter use alloca address space

2017-04-17 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL300487: CodeGen: Let byval parameter use alloca address 
space (authored by yaxunl).

Changed prior to commit:
  https://reviews.llvm.org/D32133?vs=95473&id=95478#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D32133

Files:
  cfe/trunk/lib/CodeGen/CGCall.cpp
  cfe/trunk/test/CodeGenOpenCL/byval.cl


Index: cfe/trunk/test/CodeGenOpenCL/byval.cl
===
--- cfe/trunk/test/CodeGenOpenCL/byval.cl
+++ cfe/trunk/test/CodeGenOpenCL/byval.cl
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn---amdgizcl %s | FileCheck %s 
-check-prefix=AMDGIZ
+
+struct A {
+  int x[100];
+};
+
+int f(struct A a);
+
+int g() {
+  struct A a;
+  // CHECK: call i32 @f(%struct.A* byval{{.*}}%a)
+  // AMDGIZ: call i32 @f(%struct.A addrspace(5)* byval{{.*}}%a)
+  return f(a);
+}
+
+// CHECK: declare i32 @f(%struct.A* byval{{.*}})
+// AMDGIZ: declare i32 @f(%struct.A addrspace(5)* byval{{.*}})
Index: cfe/trunk/lib/CodeGen/CGCall.cpp
===
--- cfe/trunk/lib/CodeGen/CGCall.cpp
+++ cfe/trunk/lib/CodeGen/CGCall.cpp
@@ -1586,9 +1586,10 @@
 
 case ABIArgInfo::Indirect: {
   assert(NumIRArgs == 1);
-  // indirect arguments are always on the stack, which is addr space #0.
+  // indirect arguments are always on the stack, which is alloca addr 
space.
   llvm::Type *LTy = ConvertTypeForMem(it->type);
-  ArgTypes[FirstIRArg] = LTy->getPointerTo();
+  ArgTypes[FirstIRArg] = LTy->getPointerTo(
+  CGM.getDataLayout().getAllocaAddrSpace());
   break;
 }
 


Index: cfe/trunk/test/CodeGenOpenCL/byval.cl
===
--- cfe/trunk/test/CodeGenOpenCL/byval.cl
+++ cfe/trunk/test/CodeGenOpenCL/byval.cl
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn---amdgizcl %s | FileCheck %s -check-prefix=AMDGIZ
+
+struct A {
+  int x[100];
+};
+
+int f(struct A a);
+
+int g() {
+  struct A a;
+  // CHECK: call i32 @f(%struct.A* byval{{.*}}%a)
+  // AMDGIZ: call i32 @f(%struct.A addrspace(5)* byval{{.*}}%a)
+  return f(a);
+}
+
+// CHECK: declare i32 @f(%struct.A* byval{{.*}})
+// AMDGIZ: declare i32 @f(%struct.A addrspace(5)* byval{{.*}})
Index: cfe/trunk/lib/CodeGen/CGCall.cpp
===
--- cfe/trunk/lib/CodeGen/CGCall.cpp
+++ cfe/trunk/lib/CodeGen/CGCall.cpp
@@ -1586,9 +1586,10 @@
 
 case ABIArgInfo::Indirect: {
   assert(NumIRArgs == 1);
-  // indirect arguments are always on the stack, which is addr space #0.
+  // indirect arguments are always on the stack, which is alloca addr space.
   llvm::Type *LTy = ConvertTypeForMem(it->type);
-  ArgTypes[FirstIRArg] = LTy->getPointerTo();
+  ArgTypes[FirstIRArg] = LTy->getPointerTo(
+  CGM.getDataLayout().getAllocaAddrSpace());
   break;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D32133: CodeGen: Let byval parameter use alloca address space

2017-04-17 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D32133



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D32133: CodeGen: Let byval parameter use alloca address space

2017-04-17 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.

https://reviews.llvm.org/D32133

Files:
  lib/CodeGen/CGCall.cpp
  test/CodeGenOpenCL/byval.cl


Index: test/CodeGenOpenCL/byval.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/byval.cl
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn---amdgizcl %s | FileCheck %s 
-check-prefix=AMDGIZ
+
+struct A {
+  int x[100];
+};
+
+int f(struct A a);
+
+int g() {
+  struct A a;
+  // CHECK: call i32 @f(%struct.A* byval{{.*}}%a)
+  // AMDGIZ: call i32 @f(%struct.A addrspace(5)* byval{{.*}}%a)
+  return f(a);
+}
+
+// CHECK: declare i32 @f(%struct.A* byval{{.*}})
+// AMDGIZ: declare i32 @f(%struct.A addrspace(5)* byval{{.*}})
Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1586,9 +1586,10 @@
 
 case ABIArgInfo::Indirect: {
   assert(NumIRArgs == 1);
-  // indirect arguments are always on the stack, which is addr space #0.
+  // indirect arguments are always on the stack, which is alloca addr 
space.
   llvm::Type *LTy = ConvertTypeForMem(it->type);
-  ArgTypes[FirstIRArg] = LTy->getPointerTo();
+  ArgTypes[FirstIRArg] = LTy->getPointerTo(
+  CGM.getDataLayout().getAllocaAddrSpace());
   break;
 }
 


Index: test/CodeGenOpenCL/byval.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/byval.cl
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn---amdgizcl %s | FileCheck %s -check-prefix=AMDGIZ
+
+struct A {
+  int x[100];
+};
+
+int f(struct A a);
+
+int g() {
+  struct A a;
+  // CHECK: call i32 @f(%struct.A* byval{{.*}}%a)
+  // AMDGIZ: call i32 @f(%struct.A addrspace(5)* byval{{.*}}%a)
+  return f(a);
+}
+
+// CHECK: declare i32 @f(%struct.A* byval{{.*}})
+// AMDGIZ: declare i32 @f(%struct.A addrspace(5)* byval{{.*}})
Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1586,9 +1586,10 @@
 
 case ABIArgInfo::Indirect: {
   assert(NumIRArgs == 1);
-  // indirect arguments are always on the stack, which is addr space #0.
+  // indirect arguments are always on the stack, which is alloca addr space.
   llvm::Type *LTy = ConvertTypeForMem(it->type);
-  ArgTypes[FirstIRArg] = LTy->getPointerTo();
+  ArgTypes[FirstIRArg] = LTy->getPointerTo(
+  CGM.getDataLayout().getAllocaAddrSpace());
   break;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits