This is an archive of the discontinued LLVM Phabricator instance.

[Libomptarget] Work around bug in initialization of libomptarget
ClosedPublic

Authored by jhuber6 on Mar 4 2022, 9:13 AM.

Details

Summary

Libomptarget uses some shared variables to track certain internal stated
in the runtime. This causes problems when we have code that contains no
OpenMP kernels. These variables are normally initialized upon kernel
entry, but if there are no kernels we will see no initialization.
Currently we load the runtime into each source file when not running in
LTO mode, so these variables will be erroneously considered undefined or
dead and removed, causing miscompiles. This patch temporarily works
around the most obvious case, but others still exhibit this problem. We
will need to fix this more soundly later.

Fixes #54208.

Diff Detail

Event Timeline

jhuber6 created this revision.Mar 4 2022, 9:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2022, 9:13 AM
jhuber6 requested review of this revision.Mar 4 2022, 9:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2022, 9:13 AM
jdoerfert accepted this revision.Mar 4 2022, 9:21 AM

Not happy about this but it will hide the problem better in 14 while we write the proper fix. LG

This revision is now accepted and ready to land.Mar 4 2022, 9:21 AM
jhuber6 edited the summary of this revision. (Show Details)Mar 4 2022, 9:25 AM