[PATCH] D18346: ThinLTO: special handling for LinkOnce functions

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 03:06:57 PDT 2016


joker.eph created this revision.
joker.eph added a reviewer: tejohnson.
joker.eph added a subscriber: llvm-commits.
Herald added a subscriber: joker.eph.

These function can be dropped by the compiler if they are no longer
referenced in the current module. However there is a change that
another module is still referencing them because of the import.

Multiple solutions can be used:

- Always import LinkOnce when a caller is imported. This ensure that
  every module with a call to a LinkOnce has the definition and will
  be able to emit it if it emits the call.
- Turn the LinkOnce into Weak, so that it is always emitted.
- Turn all LinkOnce into available_externally and come back after all
  modules are codegen'ed to emit only one copy of the linkonce, when
  there is still a reference to it.

This patch implement the second option, with am optimization that
only *one* module will turn the LinkOnce into Weak, while the others
will turn it into available_externally, so that there is exactly one
copy emitted for the whole compilation.

http://reviews.llvm.org/D18346

Files:
  lib/LTO/ThinLTOCodeGenerator.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18346.51265.patch
Type: text/x-patch
Size: 4976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160322/6c4fd6a2/attachment.bin>


More information about the llvm-commits mailing list