[PATCH] D59709: [ThinLTO] Auto-hide prevailing linkonce_odr only when all copies eligible

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 11:33:47 PDT 2019


tejohnson created this revision.
tejohnson added a reviewer: pcc.
Herald added subscribers: dang, arphaman, dexonsmith, eraman, inglorion, mehdi_amini.
Herald added a project: LLVM.

We hit undefined references building with ThinLTO when one source file
contained explicit instantiations of a template method (weak_odr) but
there were also implicit instantiations in another file (linkonce_odr),
and the latter was the prevailing copy. In this case the symbol was
marked hidden when the prevailing linkonce_odr copy was promoted to
weak_odr. It led to unsats when the resulting shared library was linked
with other code that contained a reference (expecting to be resolved due
to the explicit instantiation).

Add a CanAutoHide flag to the GV summary to allow the thin link to
identify when all copies are eligible for auto-hiding (because they were
all originally linkonce_odr global unnamed addr), and only do the
auto-hide in that case.

Most of the changes here are due to plumbing the new flag through the
bitcode and llvm assembly, and resulting test changes. I augmented the
existing auto-hide test to check for this situation.


Repository:
  rL LLVM

https://reviews.llvm.org/D59709

Files:
  include/llvm/IR/ModuleSummaryIndex.h
  include/llvm/IR/ModuleSummaryIndexYAML.h
  lib/Analysis/ModuleSummaryAnalysis.cpp
  lib/AsmParser/LLLexer.cpp
  lib/AsmParser/LLParser.cpp
  lib/AsmParser/LLToken.h
  lib/Bitcode/Reader/BitcodeReader.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/IR/AsmWriter.cpp
  lib/IR/ModuleSummaryIndex.cpp
  lib/LTO/LTO.cpp
  lib/Transforms/IPO/FunctionImport.cpp
  test/Assembler/thinlto-summary.ll
  test/Bitcode/thinlto-alias.ll
  test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll
  test/Bitcode/thinlto-function-summary-callgraph-relbf.ll
  test/Bitcode/thinlto-function-summary-refgraph.ll
  test/Bitcode/thinlto-type-tests.ll
  test/Bitcode/thinlto-type-vcalls.ll
  test/ThinLTO/X86/Inputs/linkonce_odr_unnamed_addr.ll
  test/ThinLTO/X86/linkonce_odr_unnamed_addr.ll
  test/Transforms/LowerTypeTests/import-unsat.ll
  test/Transforms/WholeProgramDevirt/import-indir.ll
  test/tools/gold/X86/thinlto.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59709.191914.patch
Type: text/x-patch
Size: 58311 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190322/fea68080/attachment-0001.bin>


More information about the llvm-commits mailing list