diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2019-04-09 16:31:37 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-04-09 16:31:37 +0000 |
| commit | 366f4d45c0079e0d9b0c973aeaf459840629c0b1 (patch) | |
| tree | 986432441b91f7d2061d89c3c6868ea832653055 | |
| parent | 913ba8eeb414ae351d4e3c7930ec3401ba3dd364 (diff) | |
| download | bcm5719-llvm-366f4d45c0079e0d9b0c973aeaf459840629c0b1.tar.gz bcm5719-llvm-366f4d45c0079e0d9b0c973aeaf459840629c0b1.zip | |
[OPENMP]Allow allocate directive on parameters.
Patch allows to use allocate directives on the function parameters.
llvm-svn: 358016
| -rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 3 | ||||
| -rw-r--r-- | clang/test/OpenMP/allocate_codegen.cpp | 14 |
2 files changed, 14 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 1ab0e0117f7..59df77d67d8 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -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. diff --git a/clang/test/OpenMP/allocate_codegen.cpp b/clang/test/OpenMP/allocate_codegen.cpp index 827b7012b06..c068589041a 100644 --- a/clang/test/OpenMP/allocate_codegen.cpp +++ b/clang/test/OpenMP/allocate_codegen.cpp @@ -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 |

