[LLD][ThinLTO] Handle GUID collision in import global processing
authorTeresa Johnson <tejohnson@google.com>
Fri, 25 Oct 2019 15:40:24 +0000 (08:40 -0700)
committerTeresa Johnson <tejohnson@google.com>
Fri, 25 Oct 2019 19:36:01 +0000 (12:36 -0700)
commitcc0b9647b76178bc3869bbfff80535ad86366472
tree30cc0a4d69e47b2357ef0bd7133e9fc7d5d13b3f
parenta4783ef58d3dd52b2079e885e9b4467c6b0b3a16
[LLD][ThinLTO] Handle GUID collision in import global processing

Summary:
If there are a GUID collision between two globals checking the
summarylist from the import index to make assumption can be dangerous.

Do not assume that a GlobalValue that has a GlobalVarSummary
actually is a GlobalVariable as it can be another GlobalValue with
the same GUID that the summary is connected to.

Patch by Joel Klinghed (the_jk@opera.com)

Reviewers: evgeny777, tejohnson

Reviewed By: tejohnson

Subscribers: tejohnson, dblaikie, MaskRay, mehdi_amini, inglorion, hiraditya, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67322
llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
llvm/test/ThinLTO/X86/Inputs/guid_collision.ll [new file with mode: 0644]
llvm/test/ThinLTO/X86/guid_collision.ll [new file with mode: 0644]