forked from OSchip/llvm-project
[OPENMP]Allow allocate directive on parameters.
Patch allows to use allocate directives on the function parameters. llvm-svn: 358016
This commit is contained in:
parent
913ba8eeb4
commit
366f4d45c0
|
@ -2361,9 +2361,6 @@ Sema::DeclGroupPtrTy Sema::ActOnOpenMPAllocateDirective(
|
|||
(VD->getStorageClass() == SC_Register && VD->hasAttr<AsmLabelAttr>() &&
|
||||
!VD->isLocalVarDecl()))
|
||||
continue;
|
||||
// Do not apply for parameters.
|
||||
if (isa<ParmVarDecl>(VD))
|
||||
continue;
|
||||
|
||||
// If the used several times in the allocate directive, the same allocator
|
||||
// must be used.
|
||||
|
|
|
@ -91,4 +91,18 @@ int main () {
|
|||
|
||||
// CHECK-NOT: call {{.+}} {{__kmpc_alloc|__kmpc_free}}
|
||||
extern template int ST<int>::m;
|
||||
|
||||
// CHECK: define void @{{.+}}bar{{.+}}(i32 %{{.+}}, float* {{.+}})
|
||||
void bar(int a, float &z) {
|
||||
// CHECK: [[A_VOID_PTR:%.+]] = call i8* @__kmpc_alloc(i32 [[GTID:%.+]], i64 4, i8* inttoptr (i64 1 to i8*))
|
||||
// CHECK: [[A_ADDR:%.+]] = bitcast i8* [[A_VOID_PTR]] to i32*
|
||||
// CHECK: store i32 %{{.+}}, i32* [[A_ADDR]],
|
||||
// CHECK: [[Z_VOID_PTR:%.+]] = call i8* @__kmpc_alloc(i32 [[GTID]], i64 8, i8* inttoptr (i64 1 to i8*))
|
||||
// CHECK: [[Z_ADDR:%.+]] = bitcast i8* [[Z_VOID_PTR]] to float**
|
||||
// CHECK: store float* %{{.+}}, float** [[Z_ADDR]],
|
||||
#pragma omp allocate(a,z) allocator(omp_default_mem_alloc)
|
||||
// CHECK: call void @__kmpc_free(i32 [[GTID]], i8* [[Z_VOID_PTR]], i8* inttoptr (i64 1 to i8*))
|
||||
// CHECK: call void @__kmpc_free(i32 [[GTID]], i8* [[A_VOID_PTR]], i8* inttoptr (i64 1 to i8*))
|
||||
// CHECK: ret void
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue