[PATCH] D141350: Fix runtime problem for base class member data used in target region.

Jennifer Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 9 21:06:40 PST 2023


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

The problem is happened when base class member field is used in target
region , the size is wrong, cause runtime to fail. Currently the size of
calculation is depended on index of field, since field is in base class,
the calculation is wrong.

According OpenMP 5.2 148:21:
If the target construct is within a class non-static member function,
and a variable is an accessible data member of the object for which the
non-static data member function is invoked, the variable is treated as
if the this[:1] expression had appeared in a map clause with a map-type
of tofrom.

One way to fix this is emitting code to generate this[:1] instead only
when class has any base class.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141350

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/target_map_member_expr_codegen.cpp
  openmp/libomptarget/test/mapping/target_map_for_member_data.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141350.487665.patch
Type: text/x-patch
Size: 11757 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230110/919f0dcd/attachment.bin>


More information about the cfe-commits mailing list