[Libomptarget] Do not use retaining attributes for the static library
authorJoseph Huber <jhuber6@vols.utk.edu>
Tue, 31 May 2022 14:08:25 +0000 (10:08 -0400)
committerJoseph Huber <jhuber6@vols.utk.edu>
Tue, 7 Jun 2022 16:16:34 +0000 (12:16 -0400)
commit421b1f55c6e21ab7eadc7737c1757b06577f1d71
tree772fb51c5e11d2c9b5e35b7b18bf66679da3d3b3
parenta083f3caa1356ceaec2c250850928c01008f5f58
[Libomptarget] Do not use retaining attributes for the static library

When we build the libomptarget device runtime library targeting bitcode,
we need special care to make sure that certain functions are not
optimized out. This is because we manually internalize and optimize
these definitions, ignoring their standard linkage semantics. When we
build with the static library, we can maintain these semantics and we do
not need these to be kept-alive. Furthermore, if they are kept-alive it
prevents them from being removed during LTO. This prevents us from
completely internalizing `IsSPMDMode` and removing several other
functions. This patch removes these for the static library target by
using a macro definition to enable them.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D126701
openmp/libomptarget/DeviceRTL/CMakeLists.txt
openmp/libomptarget/DeviceRTL/include/Types.h
openmp/libomptarget/DeviceRTL/src/Mapping.cpp
openmp/libomptarget/DeviceRTL/src/Utils.cpp