[Libomptarget] Add `cold` to KeepAlive attributes

This patch adds the `cold` attribute to the keepAlive functions in the
RTL. This dummy function exists to keep certain RTL calls alive without
them being optimized out, but it is never called and can be declared
cold. This also helps some erroneous remarks being given on this
function because it has weak linkage and cannot be made internal.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D117513
This commit is contained in:
Joseph Huber 2022-01-17 17:03:33 -05:00
parent 83c7f5d3fb
commit 4869a22d1d
2 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ using namespace _OMP;
namespace _OMP {
/// Helper to keep code alive without introducing a performance penalty.
__attribute__((used, retain, weak, optnone)) void keepAlive() {
__attribute__((used, retain, weak, optnone, cold)) void keepAlive() {
__kmpc_get_hardware_thread_id_in_block();
__kmpc_get_hardware_num_threads_in_block();
__kmpc_get_warp_size();

View File

@ -228,7 +228,7 @@ void __kmp_invoke_microtask(kmp_int32 global_tid, kmp_int32 bound_tid, void *fn,
namespace _OMP {
/// Helper to keep code alive without introducing a performance penalty.
__attribute__((used, retain, weak, optnone)) void keepAlive() {
__attribute__((used, retain, weak, optnone, cold)) void keepAlive() {
__kmpc_get_hardware_thread_id_in_block();
__kmpc_get_hardware_num_threads_in_block();
__kmpc_get_warp_size();