[all-commits] [llvm/llvm-project] 141c4e: [OpenMP] Do not always emit unused extern variables
Joseph Huber via All-commits
all-commits at lists.llvm.org
Fri Jul 28 09:52:21 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 141c4e7a9403fed46d84c7f0429295bd28c89368
https://github.com/llvm/llvm-project/commit/141c4e7a9403fed46d84c7f0429295bd28c89368
Author: Joseph Huber <jhuber6 at vols.utk.edu>
Date: 2023-07-28 (Fri, 28 Jul 2023)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
M clang/lib/CodeGen/CodeGenModule.cpp
M clang/test/OpenMP/declare_target_codegen.cpp
A openmp/libomptarget/test/offloading/extern.c
Log Message:
-----------
[OpenMP] Do not always emit unused extern variables
Currently, the precense of the OpenMP target declare metadata requires
that we always codegen a global declaration. This is undesirable in the
case that we could defer or omit this declaration as is common with
unused extern variables. This is important as it allows us, in the
runtime, to rely on static linking semantics to omit unused symbols so
they are not included when the user links it in.
This patch changes the check for always emitting these variables.
Because of this we also need to extend this logic to the generation of
the offloading entries. This has the result of derring the offload entry
generation to the canonical definitoin. So we are effectively assuming
whoever owns the storage for this variable will perform that operation.
This makes an exception for `link` attributes as those require their own
special handling.
Let me know if this is sound in the implementation, I do not have the
largest view of the standards here.
Fixes: https://github.com/llvm/llvm-project/issues/64133
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D156368
More information about the All-commits
mailing list