[Openmp-commits] [PATCH] D126701: [Libomptarget] Do not use retaining attributes for the static library

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue May 31 08:05:32 PDT 2022

jhuber6 added a comment.

In D126701#3547421 <https://reviews.llvm.org/D126701#3547421>, @JonChesterfield wrote:

> I don't see why going via the static library is changing the semantics of the optimisation pass. That seems bad. What're we currently doing that stops us removing the magic functions after linking the devicertl?

The bitcode library is a bit of a hack, we don't do true linking on it. When we link it in via `-mlink-builtin-bitcode` we eagerly internalize everything. This has the result that certain functions will just be optimized out when we want them to remain alive. We got around this with these hacks that just put them in the used list. The magic functions aren't removed because we can't remove them or else we would optimize out some functions or variables we might need. The difference with the static library is that it maintains all the standard semantics of a static library, so we do not optimize anything out until the final linking job when we have all the information, so there's no worry about anything being optimized out prematurely.

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list