Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion llvm/lib/Linker/IRMover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,11 +595,15 @@ Value *IRLinker::materialize(Value *V, bool ForIndirectSymbol) {
if (!SGV)
return nullptr;

// If SGV is from dest, it is already materialized when dest was loaded.
if (SGV->getParent() == &DstM)
return nullptr;

// When linking a global from other modules than source & dest, skip
// materializing it because it would be mapped later when its containing
// module is linked. Linking it now would potentially pull in many types that
// may not be mapped properly.
if (SGV->getParent() != &DstM && SGV->getParent() != SrcM.get())
if (SGV->getParent() != SrcM.get())
return nullptr;

Expected<Constant *> NewProto = linkGlobalValueProto(SGV, ForIndirectSymbol);
Expand Down
Loading