Skip to content

Commit

Permalink
[clang][NFC] Tighten up code for GetGlobalVarAddressSpace
Browse files Browse the repository at this point in the history
The LangAS local is only used in the OpenCL case; move its decl
inwards.

Differential Revision: https://reviews.llvm.org/D108449
  • Loading branch information
wingo committed Aug 23, 2021
1 parent d3d4d98 commit 8da70fe
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions clang/lib/CodeGen/CodeGenModule.cpp
Expand Up @@ -4148,16 +4148,15 @@ CharUnits CodeGenModule::GetTargetTypeStoreSize(llvm::Type *Ty) const {
}

LangAS CodeGenModule::GetGlobalVarAddressSpace(const VarDecl *D) {
LangAS AddrSpace = LangAS::Default;
if (LangOpts.OpenCL) {
AddrSpace = D ? D->getType().getAddressSpace() : LangAS::opencl_global;
assert(AddrSpace == LangAS::opencl_global ||
AddrSpace == LangAS::opencl_global_device ||
AddrSpace == LangAS::opencl_global_host ||
AddrSpace == LangAS::opencl_constant ||
AddrSpace == LangAS::opencl_local ||
AddrSpace >= LangAS::FirstTargetAddressSpace);
return AddrSpace;
LangAS AS = D ? D->getType().getAddressSpace() : LangAS::opencl_global;
assert(AS == LangAS::opencl_global ||
AS == LangAS::opencl_global_device ||
AS == LangAS::opencl_global_host ||
AS == LangAS::opencl_constant ||
AS == LangAS::opencl_local ||
AS >= LangAS::FirstTargetAddressSpace);
return AS;
}

if (LangOpts.SYCLIsDevice &&
Expand Down

0 comments on commit 8da70fe

Please sign in to comment.