[PATCH] D41624: Fix crash when linking metadata with ODR type uniquing

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 28 21:50:35 PST 2017


tejohnson created this revision.
tejohnson added reviewers: mehdi_amini, pcc.
Herald added a subscriber: eraman.

With DebugTypeODRUniquing enabled, during IR linking debug metadata
in the destination module may be reached from the source module.
This means that ConstantAsMetadata nodes (e.g. on DITemplateValueParameter)
may contain a value the destination module. When trying to map such
metadata nodes, we will attempt to map a GV already in the dest module.
linkGlobalValueProto will end up with a source GV that is the same as
the dest GV as well as the new GV. Trying to access the TypeMap for the
source GV type, which is actually a dest GV type, hits an assertion
since it appears that we have mapped into the source module (because the
type is the value not a key into the map).

Detect that we don't need to access the TypeMap in this case, since
there is no need to create a bitcast from the new GV to the source GV
type as they GV are the same.

Fixes PR35722.


https://reviews.llvm.org/D41624

Files:
  lib/Linker/IRMover.cpp
  test/ThinLTO/X86/Inputs/dicompositetype-unique2.ll
  test/ThinLTO/X86/dicompositetype-unique2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41624.128316.patch
Type: text/x-patch
Size: 9913 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171229/5d202922/attachment.bin>


More information about the llvm-commits mailing list