[PATCH] D32248: CodeGen: Cast alloca to expected address space

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 24 07:25:58 PDT 2017


Anastasia added inline comments.


================
Comment at: lib/CodeGen/CGDecl.cpp:1115
+  if (AddrTy->getAddressSpace() != ExpectedAddrSpace &&
+      Ty.getAddressSpace() != LangAS::opencl_constant) {
+    address = Address(Builder.CreateAddrSpaceCast(Addr,
----------------
Do you need to check this? I thought your change doesn't affect OpenCL because alloca AS == private AS in OpenCL  and constant AS local objects are treated as private const objects anyways.


================
Comment at: test/CodeGen/address-space.c:3
 // RUN: %clang_cc1 -triple amdgcn -emit-llvm < %s | FileCheck -check-prefixes=CHECK,PIZ %s
 // RUN: %clang_cc1 -triple amdgcn---amdgiz -emit-llvm < %s | FileCheck -check-prefixes=CHeCK,GIZ %s
 
----------------
CHeCK -> CHECK


================
Comment at: test/CodeGenCXX/amdgcn-automatic-variable.cpp:25
+  // CHECK: store i32 2, i32* %[[r1]]
+  int lv1;
+  lv1 = 1;
----------------
I am wondering if all these different test cases are really needed. Are we testing any different program paths from the patch?

Also would it make sense to add a test case with an object in an AS different to 0 (i.e. with `__attribute__((address_space(n)))`)


https://reviews.llvm.org/D32248





More information about the cfe-commits mailing list