GPGPU: Generate kernel parameter allocation with right size

Before this change we miscounted the number of function parameters.

llvm-svn: 276960
This commit is contained in:
Tobias Grosser 2016-07-28 06:47:50 +00:00
parent 19d024b2fd
commit 4e18d71c71
2 changed files with 3 additions and 2 deletions

View File

@ -880,7 +880,8 @@ GPUNodeBuilder::getBlockSizes(ppcg_kernel *Kernel) {
Value *GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel,
Function *F) {
Type *ArrayTy = ArrayType::get(Builder.getInt8PtrTy(), F->getNumOperands());
Type *ArrayTy = ArrayType::get(Builder.getInt8PtrTy(),
std::distance(F->arg_begin(), F->arg_end()));
BasicBlock *EntryBlock =
&Builder.GetInsertBlock()->getParent()->getEntryBlock();

View File

@ -98,7 +98,7 @@
; IR-NEXT: call void @polly_copyFromHostToDevice(i8* [[HostPtr]], i8* %p_dev_array_MemRef_A, i64 4194304)
; IR-NEXT: [[DevPtr:%.*]] = call i8* @polly_getDevicePtr(i8* %p_dev_array_MemRef_A)
; IR-NEXT: store i8* [[DevPtr]], i8** %polly_launch_0_param_0
; IR-NEXT: [[ParamSlot:%.*]] = getelementptr [0 x i8*], [0 x i8*]* %polly_launch_0_params, i64 0, i64 0
; IR-NEXT: [[ParamSlot:%.*]] = getelementptr [1 x i8*], [1 x i8*]* %polly_launch_0_params, i64 0, i64 0
; IR-NEXT: [[ParamTyped:%.*]] = bitcast i8** %polly_launch_0_param_0 to i8*
; IR-NEXT: store i8* [[ParamTyped]], i8** [[ParamSlot]]
; IR-NEXT: call i8* @polly_getKernel