[PATCH] D53890: [LTO] Record LTOUnit flag in index and validate during LTO link

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 13:33:48 PDT 2018


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

Records in the module summary index whether the bitcode was compiled
with the option necessary to create an LTO unit (e.g. -flto-unit).

This is then used during the LTO link to verify that all linked
summaries were built with the same value of this flag. If not, an error
is issued since transformations such as CFI and Whole Program
Devirtualization that require whole program visibility to the class
hierarchy may not generate correct code.

Note I have also changed the ThinLTOBitcodeWriter to also gate the
module splitting on the value of the LTOUnit flag. This does not change
the status quo, since currently clang will not generate the type
metadata that induces the splitting unless LTOUnit is set. Eventually,
however, we will want type metadata even without LTOUnit (for purely
summary-based class hierarchy analyses).

Clang side patch being sent separately.


Repository:
  rL LLVM

https://reviews.llvm.org/D53890

Files:
  include/llvm/Analysis/ModuleSummaryAnalysis.h
  include/llvm/Bitcode/BitcodeReader.h
  include/llvm/Bitcode/BitcodeWriterPass.h
  include/llvm/IR/ModuleSummaryIndex.h
  include/llvm/LTO/LTO.h
  include/llvm/Transforms/IPO.h
  include/llvm/Transforms/IPO/ThinLTOBitcodeWriter.h
  lib/Analysis/ModuleSummaryAnalysis.cpp
  lib/Bitcode/Reader/BitcodeReader.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/Bitcode/Writer/BitcodeWriterPass.cpp
  lib/LTO/LTO.cpp
  lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
  test/Bitcode/thinlto-alias.ll
  test/Bitcode/thinlto-alias2.ll
  test/Bitcode/thinlto-function-summary-callgraph-cast.ll
  test/Bitcode/thinlto-function-summary-callgraph-pgo.ll
  test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll
  test/Bitcode/thinlto-function-summary-callgraph-relbf.ll
  test/Bitcode/thinlto-function-summary-callgraph-sample-profile-summary.ll
  test/Bitcode/thinlto-function-summary-callgraph.ll
  test/Bitcode/thinlto-function-summary.ll
  test/LTO/Resolution/X86/lto-unit-check.ll
  tools/opt/NewPMDriver.cpp
  tools/opt/opt.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53890.171777.patch
Type: text/x-patch
Size: 28156 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/1a81d6af/attachment.bin>


More information about the llvm-commits mailing list