[PATCH] D30845: Fix array sizes where address space is not yet known
Konstantin Zhuravlyov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 21 12:07:53 PDT 2017
This revision was automatically updated to reflect the committed changes.
kzhuravl marked an inline comment as done.
Closed by commit rL298420: Fix array sizes where address space is not yet known (authored by kzhuravl).
Changed prior to commit:
https://reviews.llvm.org/D30845?vs=91404&id=92523#toc
Repository:
rL LLVM
https://reviews.llvm.org/D30845
Files:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl
Index: cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl
===================================================================
--- cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl
+++ cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl
@@ -0,0 +1,12 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: @One = common local_unnamed_addr addrspace(1) global [6442450944 x i8] zeroinitializer, align 1
+unsigned char One[6442450944];
+// CHECK: @Two = common local_unnamed_addr addrspace(1) global [6442450944 x i32] zeroinitializer, align 4
+global unsigned int Two[6442450944];
+
+kernel void large_globals(unsigned int id) {
+ One[id] = id;
+ Two[id + 1] = id + 1;
+}
Index: cfe/trunk/lib/AST/ASTContext.cpp
===================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp
+++ cfe/trunk/lib/AST/ASTContext.cpp
@@ -2692,8 +2692,7 @@
// Convert the array size into a canonical width matching the pointer size for
// the target.
llvm::APInt ArySize(ArySizeIn);
- ArySize =
- ArySize.zextOrTrunc(Target->getPointerWidth(getTargetAddressSpace(EltTy)));
+ ArySize = ArySize.zextOrTrunc(Target->getMaxPointerWidth());
llvm::FoldingSetNodeID ID;
ConstantArrayType::Profile(ID, EltTy, ArySize, ASM, IndexTypeQuals);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30845.92523.patch
Type: text/x-patch
Size: 1382 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170321/4dc01d82/attachment.bin>
More information about the cfe-commits
mailing list