From c1b7841960dc0b3719c9029a89ebb762881125b1 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 15 Nov 2012 16:40:35 +0000 Subject: [PATCH] Simplify code. No functionality change. llvm-svn: 168047 --- clang/lib/CodeGen/CodeGenFunction.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index d7ccfc9..f425e1d 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -296,30 +296,24 @@ void CodeGenFunction::EmitOpenCLKernelMetadata(const FunctionDecl *FD, GenOpenCLArgMetadata(FD, Fn, CGM, Context, kernelMDArgs); if (FD->hasAttr()) { - llvm::SmallVector attrMDArgs; - attrMDArgs.push_back(llvm::MDString::get(Context, "work_group_size_hint")); WorkGroupSizeHintAttr *attr = FD->getAttr(); - llvm::Type *iTy = llvm::IntegerType::get(Context, 32); - attrMDArgs.push_back(llvm::ConstantInt::get(iTy, - llvm::APInt(32, (uint64_t)attr->getXDim()))); - attrMDArgs.push_back(llvm::ConstantInt::get(iTy, - llvm::APInt(32, (uint64_t)attr->getYDim()))); - attrMDArgs.push_back(llvm::ConstantInt::get(iTy, - llvm::APInt(32, (uint64_t)attr->getZDim()))); + llvm::Value *attrMDArgs[] = { + llvm::MDString::get(Context, "work_group_size_hint"), + Builder.getInt32(attr->getXDim()), + Builder.getInt32(attr->getYDim()), + Builder.getInt32(attr->getZDim()) + }; kernelMDArgs.push_back(llvm::MDNode::get(Context, attrMDArgs)); } if (FD->hasAttr()) { - llvm::SmallVector attrMDArgs; - attrMDArgs.push_back(llvm::MDString::get(Context, "reqd_work_group_size")); ReqdWorkGroupSizeAttr *attr = FD->getAttr(); - llvm::Type *iTy = llvm::IntegerType::get(Context, 32); - attrMDArgs.push_back(llvm::ConstantInt::get(iTy, - llvm::APInt(32, (uint64_t)attr->getXDim()))); - attrMDArgs.push_back(llvm::ConstantInt::get(iTy, - llvm::APInt(32, (uint64_t)attr->getYDim()))); - attrMDArgs.push_back(llvm::ConstantInt::get(iTy, - llvm::APInt(32, (uint64_t)attr->getZDim()))); + llvm::Value *attrMDArgs[] = { + llvm::MDString::get(Context, "reqd_work_group_size"), + Builder.getInt32(attr->getXDim()), + Builder.getInt32(attr->getYDim()), + Builder.getInt32(attr->getZDim()) + }; kernelMDArgs.push_back(llvm::MDNode::get(Context, attrMDArgs)); } -- 2.7.4