[cfe-commits] r168047 - /cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
Benjamin Kramer
benny.kra at googlemail.com
Thu Nov 15 08:40:35 PST 2012
Author: d0k
Date: Thu Nov 15 10:40:35 2012
New Revision: 168047
URL: http://llvm.org/viewvc/llvm-project?rev=168047&view=rev
Log:
Simplify code. No functionality change.
Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=168047&r1=168046&r2=168047&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Thu Nov 15 10:40:35 2012
@@ -296,30 +296,24 @@
GenOpenCLArgMetadata(FD, Fn, CGM, Context, kernelMDArgs);
if (FD->hasAttr<WorkGroupSizeHintAttr>()) {
- llvm::SmallVector <llvm::Value*, 5> attrMDArgs;
- attrMDArgs.push_back(llvm::MDString::get(Context, "work_group_size_hint"));
WorkGroupSizeHintAttr *attr = FD->getAttr<WorkGroupSizeHintAttr>();
- 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<ReqdWorkGroupSizeAttr>()) {
- llvm::SmallVector <llvm::Value*, 5> attrMDArgs;
- attrMDArgs.push_back(llvm::MDString::get(Context, "reqd_work_group_size"));
ReqdWorkGroupSizeAttr *attr = FD->getAttr<ReqdWorkGroupSizeAttr>();
- 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));
}
More information about the cfe-commits
mailing list