[PATCH] D69561: [ThinLTO] Import readonly vars with refs

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 09:05:21 PDT 2019


evgeny777 updated this revision to Diff 227288.
evgeny777 added a comment.

Addressed.

Adding new flag to summary index allowed better handling cases when actual dead symbol computation was skipped for some reason. See modifications in `processGlobalForThinLTO` and updated test cases.

> One thing that should be considered for a follow-up enhancement is to consider the refs themselves for importing (similar to the way we follow chains of calls when doing function importing).

This has to be done with caution, because importing everything actually makes things worse due to promotion in source modules.
One thing which is worth doing is calculating references from initializer to constant object, e.g:

  static const struct A { ... } objA = { ... };
  struct B { A *pA; } objB = { &objA };

and import such references.

Another thing which seems also worth doing is computing functions which doesn't modify their pointer arguments. Calling such functions with
global object pointer doesn't violate readonly property. Also this could be a base for some other optimizations (like argument promotion).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69561/new/

https://reviews.llvm.org/D69561

Files:
  include/llvm/IR/ModuleSummaryIndex.h
  lib/Bitcode/Reader/BitcodeReader.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/IR/ModuleSummaryIndex.cpp
  lib/Transforms/IPO/FunctionImport.cpp
  lib/Transforms/Utils/FunctionImportUtils.cpp
  test/Bitcode/summary_version.ll
  test/Bitcode/thinlto-deadstrip-flag.ll
  test/Bitcode/thinlto-synthetic-count-flag.ll
  test/ThinLTO/X86/Inputs/indirect-call.ll
  test/ThinLTO/X86/globals-import.ll
  test/ThinLTO/X86/indirect-call.ll
  test/ThinLTO/X86/local_name_conflict.ll
  test/tools/gold/X86/v1.12/thinlto_emit_linked_objects.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69561.227288.patch
Type: text/x-patch
Size: 16231 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191031/f2c154b2/attachment.bin>


More information about the llvm-commits mailing list