diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2012-08-28 20:37:10 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2012-08-28 20:37:10 +0000 |
| commit | ee0502d5511594a834a46ab9c60518b1f72a710a (patch) | |
| tree | 3147b13d697d631593526f68231c01d85c6bf888 /clang/lib/CodeGen/CGDecl.cpp | |
| parent | 7ae63607587e651afd394fe522722a0be3669e22 (diff) | |
| download | bcm5719-llvm-ee0502d5511594a834a46ab9c60518b1f72a710a.tar.gz bcm5719-llvm-ee0502d5511594a834a46ab9c60518b1f72a710a.zip | |
CUDA: give correct address space to globals declared in functions
llvm-svn: 162787
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 35d1a623a83..b9489e3f040 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -184,12 +184,14 @@ CodeGenFunction::CreateStaticVarDecl(const VarDecl &D, Name = GetStaticDeclName(*this, D, Separator); llvm::Type *LTy = CGM.getTypes().ConvertTypeForMem(Ty); + unsigned AddrSpace = + CGM.GetGlobalVarAddressSpace(&D, CGM.getContext().getTargetAddressSpace(Ty)); llvm::GlobalVariable *GV = new llvm::GlobalVariable(CGM.getModule(), LTy, Ty.isConstant(getContext()), Linkage, CGM.EmitNullConstant(D.getType()), Name, 0, llvm::GlobalVariable::NotThreadLocal, - CGM.getContext().getTargetAddressSpace(Ty)); + AddrSpace); GV->setAlignment(getContext().getDeclAlign(&D).getQuantity()); if (Linkage != llvm::GlobalValue::InternalLinkage) GV->setVisibility(CurFn->getVisibility()); |

