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 | b9d5ec18aeca2aab63e20a601643e01f371a07f1 (patch) | |
| tree | 374d7a3ce681451f4331084e9ef5d977d26fab04 /lib/CodeGen/TargetInfo.cpp | |
| parent | 1d0132b58b56ac1bdadc62e559b22dd4c4ebae73 (diff) | |
| download | clang-b9d5ec18aeca2aab63e20a601643e01f371a07f1.tar.gz clang-b9d5ec18aeca2aab63e20a601643e01f371a07f1.tar.bz2 clang-b9d5ec18aeca2aab63e20a601643e01f371a07f1.tar.xz | |
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
Diffstat (limited to 'lib/CodeGen/TargetInfo.cpp')
| -rw-r--r-- | lib/CodeGen/TargetInfo.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
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<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 |
