r358016 - [OPENMP]Allow allocate directive on parameters.
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 9 09:31:37 PDT 2019
Author: abataev
Date: Tue Apr 9 09:31:37 2019
New Revision: 358016
URL: http://llvm.org/viewvc/llvm-project?rev=358016&view=rev
Log:
[OPENMP]Allow allocate directive on parameters.
Patch allows to use allocate directives on the function parameters.
Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/allocate_codegen.cpp
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=358016&r1=358015&r2=358016&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Tue Apr 9 09:31:37 2019
@@ -2361,9 +2361,6 @@ Sema::DeclGroupPtrTy Sema::ActOnOpenMPAl
(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.
Modified: cfe/trunk/test/OpenMP/allocate_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/allocate_codegen.cpp?rev=358016&r1=358015&r2=358016&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/allocate_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/allocate_codegen.cpp Tue Apr 9 09:31:37 2019
@@ -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
More information about the cfe-commits
mailing list