[clang] 8da70fe - [clang][NFC] Tighten up code for GetGlobalVarAddressSpace
Andy Wingo via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 23 06:08:02 PDT 2021
Author: Andy Wingo
Date: 2021-08-23T14:55:58+02:00
New Revision: 8da70fed704c15d9656cbf2df190122acb975921
URL: https://github.com/llvm/llvm-project/commit/8da70fed704c15d9656cbf2df190122acb975921
DIFF: https://github.com/llvm/llvm-project/commit/8da70fed704c15d9656cbf2df190122acb975921.diff
LOG: [clang][NFC] Tighten up code for GetGlobalVarAddressSpace
The LangAS local is only used in the OpenCL case; move its decl
inwards.
Differential Revision: https://reviews.llvm.org/D108449
Added:
Modified:
clang/lib/CodeGen/CodeGenModule.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 7723c4e70bbf..13d7cce880e0 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -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 &&
More information about the cfe-commits
mailing list