[PATCH] D151517: Fix couple of problems in uses_allocators clause.

Jennifer Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 25 16:33:01 PDT 2023


jyu2 created this revision.
jyu2 added reviewers: ABataev, jdoerfert.
jyu2 added projects: OpenMP, clang.
Herald added a project: All.
jyu2 requested review of this revision.
Herald added subscribers: openmp-commits, cfe-commits, jplehr, sstefan1.

1> Fix wrong error message when compiling C souce code:
Currently emit error as following for uses_allocators(alloc(traits)):

called object type 'omp_allocator_handle_t' (aka
'enum omp_allocator_handle_t') is not a function or function pointer

To fix this, since "alloc" is Id expresison(spce 5.2), during the parser
(in ParseOpenMP.cpp), using tryParseCXXIdExpression instead of
ParseExpression for C.

2> Fix runtime problem when call to __kmpc_init_allocator
It seem load of traits.addr should be passed in rumtime call.  Curently
the load of load traits.addr gets passed cause runtime to fail.

3> change to use CGF.EmitAutoVarAlloca(allocator) instead
CGF.EmitVarDecl(allocator).
If I understant correct, it is not necessary to emit variable init,
since "allocator" is private to target region.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151517

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/test/OpenMP/target_parallel_for_simd_uses_allocators_codegen.cpp
  clang/test/OpenMP/target_parallel_for_uses_allocators_codegen.cpp
  clang/test/OpenMP/target_parallel_uses_allocators_codegen.cpp
  clang/test/OpenMP/target_simd_uses_allocators_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_simd_uses_allocators_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_uses_allocators_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_simd_uses_allocators_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_uses_allocators_codegen.cpp
  clang/test/OpenMP/target_teams_uses_allocators_codegen.cpp
  clang/test/OpenMP/target_uses_allocators.c
  clang/test/OpenMP/target_uses_allocators_codegen.cpp
  openmp/libomptarget/test/mapping/target_uses_allocator.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151517.525867.patch
Type: text/x-patch
Size: 15686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230525/244c5608/attachment-0001.bin>


More information about the cfe-commits mailing list