[PATCH] D108449: [clang][NFC] Tighten up code for GetGlobalVarAddressSpace
Andy Wingo via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 20 00:48:48 PDT 2021
wingo created this revision.
Herald added a subscriber: Anastasia.
wingo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
The LangAS local is only used in the OpenCL case; move its decl
inwards.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D108449
Files:
clang/lib/CodeGen/CodeGenModule.cpp
Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -4148,16 +4148,15 @@
}
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 &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108449.367727.patch
Type: text/x-patch
Size: 1187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210820/4531b368/attachment.bin>
More information about the cfe-commits
mailing list