[PATCH] D25359: [ThinLTO] Handle module level inline assembly
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 6 21:36:48 PDT 2016
tejohnson created this revision.
tejohnson added a reviewer: mehdi_amini.
tejohnson added a subscriber: llvm-commits.
tejohnson added a dependency: D25345: [ThinLTO] Handle empty summaries during internalization.
Fix a couple issues related to module level inline assembly and ThinLTO.
The first is that module inline asm was always being linked/concatenated
when running the IRLinker. This is correct for full LTO but not when
we are importing for ThinLTO, as it can result in multiply defined
symbols when the module asm defines a global symbol.
However, when the module asm defines a local instead, importing the
definition or a reference could require renaming of that value in
the module asm, which isn't currently supported (this is an issue with
full LTO as well if there are conflicts between the local defined
in module asm and another symbol in the merged module). Address this
similar to how we handle inline asm, by suppressing the generation
of the index, which prevents importing from the module.
The second fix required parsing module assembly, which required
initializing MCAsmParsers in 'opt'. To avoid silently ignorning
the module asm in the future, I added an assert to
IRObjectFile::CollectAsmUndefinedRefs to ensure that there is a target
triple and an initialized MCAsmParser
Finally, in order to test with llvm-lto2, I had to work around PR30396,
where a symbol that is defined in module assembly but defined in the
LLVM IR appears twice. Added workaround to llvm-lto2 with a FIXME.
Depends on https://reviews.llvm.org/D25345.
Fixes PR30610.
https://reviews.llvm.org/D25359
Files:
include/llvm/Linker/IRMover.h
include/llvm/Support/TargetRegistry.h
lib/Analysis/LLVMBuild.txt
lib/Analysis/ModuleSummaryAnalysis.cpp
lib/LTO/LTO.cpp
lib/Linker/IRMover.cpp
lib/Linker/LinkModules.cpp
lib/Object/IRObjectFile.cpp
test/LTO/X86/current-section.ll
test/ThinLTO/X86/Inputs/module_asm.ll
test/ThinLTO/X86/module_asm_glob.ll
test/ThinLTO/X86/module_asm_local.ll
tools/llvm-lto2/llvm-lto2.cpp
tools/opt/opt.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25359.73883.patch
Type: text/x-patch
Size: 13389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161007/ebc98cad/attachment.bin>
More information about the llvm-commits
mailing list