[PATCH] D148805: [Clang][OpenMP] Avoid emitting a __kmpc_alloc_shared for implicit casts which do not have their address taken

Gheorghe-Teodor Bercea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 20 07:37:46 PDT 2023


doru1004 created this revision.
doru1004 added reviewers: ronl, jdoerfert, jhuber6, carlo.bertolli, JonChesterfield, dhruvachak, gregrodgers, ABataev.
doru1004 added a project: OpenMP.
Herald added subscribers: sunshaoce, guansong, yaxunl.
Herald added a project: All.
doru1004 requested review of this revision.
Herald added subscribers: cfe-commits, jplehr, sstefan1.
Herald added a project: clang.

This patch avoids emitting `__kmpc_alloc_shared` allocation calls for implicitly cast variables which are `CK_ArrayToPointerDecay` that are not having their address taken explicitly.

Note: if the condition should be refined instead of removed then I am looking for suggestions as to how to keep the check for CK_ArrayToPointerDecay but restrict its applicability with further conditions. It is not clear to me what those conditions could be hence the complete removal of the condition. So far none of the existing lit tests needed to be changed as a consuquence of this change and no  LLVM/OpenMP tests have failed.

OpenMP-Opt is usually able to transform the `__kmpc_alloc_shared` calls emitted this way to allocas except in this case the size of the allocated local array (256) is preventing that from happening (limit is 128).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148805

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/test/OpenMP/target_alloc_shared_emission.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148805.515325.patch
Type: text/x-patch
Size: 59202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230420/86e36194/attachment-0001.bin>


More information about the cfe-commits mailing list