[llvm] r263143 - Materialize metadata in IRLinker before value mapping
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 10 10:47:03 PST 2016
Author: tejohnson
Date: Thu Mar 10 12:47:03 2016
New Revision: 263143
URL: http://llvm.org/viewvc/llvm-project?rev=263143&view=rev
Log:
Materialize metadata in IRLinker before value mapping
Summary:
Unless we plan to do later postpass metadata linking (ThinLTO special mode),
always invoke metadata materialization at the start of IRLinker::run().
This avoids the need for clients who use lazy metadata loading to
explicitly invoke materializeMetadata before the IRMover, which in
turn invokes IRLinker::run and needs materialized metadata for mapping.
Came up in the context of an LLD issue (D17982).
Reviewers: rafael
Subscribers: silvas, llvm-commits
Differential Revision: http://reviews.llvm.org/D17992
Modified:
llvm/trunk/lib/Linker/IRMover.cpp
Modified: llvm/trunk/lib/Linker/IRMover.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/IRMover.cpp?rev=263143&r1=263142&r2=263143&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/IRMover.cpp (original)
+++ llvm/trunk/lib/Linker/IRMover.cpp Thu Mar 10 12:47:03 2016
@@ -1492,6 +1492,11 @@ static std::string mergeTriples(const Tr
}
bool IRLinker::run() {
+ // Ensure metadata materialized before value mapping.
+ if (shouldLinkMetadata() && SrcM->getMaterializer())
+ if (SrcM->getMaterializer()->materializeMetadata())
+ return true;
+
// Inherit the target data from the source module if the destination module
// doesn't have one already.
if (DstM.getDataLayout().isDefault())
@@ -1559,13 +1564,9 @@ bool IRLinker::run() {
// Even if just linking metadata we should link decls above in case
// any are referenced by metadata. IRLinker::shouldLink ensures that
// we don't actually link anything from source.
- if (IsMetadataLinkingPostpass) {
- // Ensure metadata materialized
- if (SrcM->getMaterializer()->materializeMetadata())
- return true;
+ if (IsMetadataLinkingPostpass)
SrcM->getMaterializer()->saveMetadataList(MetadataToIDs,
/* OnlyTempMD = */ false);
- }
linkNamedMDNodes();
More information about the llvm-commits
mailing list