From: Aaron Ballman Date: Thu, 19 Dec 2013 13:16:35 +0000 (+0000) Subject: Hosting a call to getAttr so that we don't call it multiple times for the same attrib... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b9d5ec18aeca2aab63e20a601643e01f371a07f1;p=clang Hosting a call to getAttr so that we don't call it multiple times for the same attribute. Also removes a hasAttr that's not required. No functional changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197675 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index f5278c0345..da627756c8 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -5020,9 +5020,8 @@ void TCETargetCodeGenInfo::SetTargetAttributes(const Decl *D, if (FD->hasAttr()) { // OpenCL C Kernel functions are not subject to inlining F->addFnAttr(llvm::Attribute::NoInline); - - if (FD->hasAttr()) { - + const ReqdWorkGroupSizeAttr *Attr = FD->getAttr(); + if (Attr) { // Convert the reqd_work_group_size() attributes to metadata. llvm::LLVMContext &Context = F->getContext(); llvm::NamedMDNode *OpenCLMetadata = @@ -5032,14 +5031,11 @@ void TCETargetCodeGenInfo::SetTargetAttributes(const Decl *D, Operands.push_back(F); Operands.push_back(llvm::Constant::getIntegerValue(M.Int32Ty, - llvm::APInt(32, - FD->getAttr()->getXDim()))); + llvm::APInt(32, Attr->getXDim()))); Operands.push_back(llvm::Constant::getIntegerValue(M.Int32Ty, - llvm::APInt(32, - FD->getAttr()->getYDim()))); + llvm::APInt(32, Attr->getYDim()))); Operands.push_back(llvm::Constant::getIntegerValue(M.Int32Ty, - llvm::APInt(32, - FD->getAttr()->getZDim()))); + llvm::APInt(32, Attr->getZDim()))); // Add a boolean constant operand for "required" (true) or "hint" (false) // for implementing the work_group_size_hint attr later. Currently