[PATCH] D137649: [Clang][OpenMP] Warn and discard write to host for const variable

Jan-Patrick Lehr via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 8 08:39:32 PST 2022


jplehr created this revision.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
jplehr requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Resolves a potential segmentation fault in target offload when a constant
variable is mapped as tofrom to the device but placed into constant
memory on the host.

Sema checks if targets of map from: or tofrom: are const-qualified and
warns.
CodeGen changes the map to to: for such variables to remove the write
back to host.
OpenMP Clarification: https://github.com/OpenMP/spec/issues/2158


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137649

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/distribute_firstprivate_messages.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_messages.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_messages.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_messages.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_aligned_messages.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_shared_messages.cpp
  clang/test/OpenMP/distribute_simd_aligned_messages.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_messages.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_messages.cpp
  clang/test/OpenMP/distribute_simd_linear_messages.cpp
  clang/test/OpenMP/distribute_simd_reduction_messages.cpp
  clang/test/OpenMP/target_teams_distribute_firstprivate_messages.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_simd_aligned_messages.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp
  clang/test/OpenMP/teams_distribute_simd_aligned_messages.cpp
  clang/test/OpenMP/teams_distribute_simd_linear_messages.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137649.474017.patch
Type: text/x-patch
Size: 40421 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221108/bc4f0505/attachment-0001.bin>


More information about the cfe-commits mailing list