diff options
| author | Aaron Ballman <aaron@aaronballman.com> | 2013-12-19 13:16:35 +0000 |
|---|---|---|
| committer | Aaron Ballman <aaron@aaronballman.com> | 2013-12-19 13:16:35 +0000 |
| commit | 36a18ffef1e67bc21f4382c9196e082ba2661674 (patch) | |
| tree | d30e1690b22a25160abb00befd577896427df687 | |
| parent | 48703be503e4071c7f85f8476cb95d99b9583a15 (diff) | |
| download | bcm5719-llvm-36a18ffef1e67bc21f4382c9196e082ba2661674.tar.gz bcm5719-llvm-36a18ffef1e67bc21f4382c9196e082ba2661674.zip | |
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.
llvm-svn: 197675
| -rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index f5278c0345c..da627756c80 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -5020,9 +5020,8 @@ void TCETargetCodeGenInfo::SetTargetAttributes(const Decl *D, if (FD->hasAttr<OpenCLKernelAttr>()) { // OpenCL C Kernel functions are not subject to inlining F->addFnAttr(llvm::Attribute::NoInline); - - if (FD->hasAttr<ReqdWorkGroupSizeAttr>()) { - + const ReqdWorkGroupSizeAttr *Attr = FD->getAttr<ReqdWorkGroupSizeAttr>(); + 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<ReqdWorkGroupSizeAttr>()->getXDim()))); + llvm::APInt(32, Attr->getXDim()))); Operands.push_back(llvm::Constant::getIntegerValue(M.Int32Ty, - llvm::APInt(32, - FD->getAttr<ReqdWorkGroupSizeAttr>()->getYDim()))); + llvm::APInt(32, Attr->getYDim()))); Operands.push_back(llvm::Constant::getIntegerValue(M.Int32Ty, - llvm::APInt(32, - FD->getAttr<ReqdWorkGroupSizeAttr>()->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 |

