[PATCH] D70006: [ThinLTO] Fix bug when importing writeonly variables

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 06:06:23 PST 2019


evgeny777 created this revision.
evgeny777 added reviewers: tejohnson, steven_wu.
Herald added subscribers: arphaman, dexonsmith, hiraditya, inglorion, mehdi_amini.
Herald added a project: LLVM.

D69561introduced a bug which causes writeonly variable with non-trivial initializer (with references) to be internalized in source module and its declaration imported to destination module. This causes linker errors. To fix this bug I suggest importing such variable definitions, but convert them to `zeroinitializer` before doing so in order to avoid promotion of referenced objects which are not accessed anyway.


https://reviews.llvm.org/D70006

Files:
  llvm/lib/IR/ModuleSummaryIndex.cpp
  llvm/lib/Transforms/IPO/FunctionImport.cpp
  llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
  llvm/test/ThinLTO/X86/Inputs/writeonly-with-refs.ll
  llvm/test/ThinLTO/X86/writeonly-with-refs.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70006.228428.patch
Type: text/x-patch
Size: 4534 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191108/9fa57ce5/attachment.bin>


More information about the llvm-commits mailing list