[PATCH] D70404: [ThinLTO] Always treat constant objects as readonly

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 09:38:27 PST 2019


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

Since D69561 <https://reviews.llvm.org/D69561> we started to import readonly vars with non-trivial initializers. However this isn't always the case with compile time constants, because thin LTO analysis pass is not always detecting them as readonly. Such thing happens in two cases:

- constant object is referenced in initializer of some other object
- constant object is referenced by instruction which is not non-volatile load.

This patch forces read-only attribute for constants, regardless of their usage


https://reviews.llvm.org/D70404

Files:
  llvm/include/llvm/IR/ModuleSummaryIndex.h
  llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/ModuleSummaryIndex.cpp
  llvm/test/Assembler/thinlto-summary.ll
  llvm/test/Bitcode/summary_version.ll
  llvm/test/Bitcode/thinlto-function-summary-refgraph.ll
  llvm/test/ThinLTO/X86/Inputs/import-constant.ll
  llvm/test/ThinLTO/X86/devirt.ll
  llvm/test/ThinLTO/X86/devirt2.ll
  llvm/test/ThinLTO/X86/import-constant.ll
  llvm/test/ThinLTO/X86/referenced_by_constant.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70404.229869.patch
Type: text/x-patch
Size: 21575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191118/1acb3e5d/attachment.bin>


More information about the llvm-commits mailing list