[llvm-commits] [llvm] r106560 - /llvm/trunk/lib/Transforms/Utils/CloneModule.cpp
Devang Patel
dpatel at apple.com
Tue Jun 22 11:52:38 PDT 2010
Author: dpatel
Date: Tue Jun 22 13:52:38 2010
New Revision: 106560
URL: http://llvm.org/viewvc/llvm-project?rev=106560&view=rev
Log:
Clone named metadata while cloning a module.
Reapply Bob's patch.
Modified:
llvm/trunk/lib/Transforms/Utils/CloneModule.cpp
Modified: llvm/trunk/lib/Transforms/Utils/CloneModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneModule.cpp?rev=106560&r1=106559&r2=106560&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneModule.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneModule.cpp Tue Jun 22 13:52:38 2010
@@ -122,6 +122,17 @@
if (const Constant* C = I->getAliasee())
GA->setAliasee(cast<Constant>(MapValue(C, ValueMap)));
}
+
+ // And named metadata....
+ for (Module::const_named_metadata_iterator I = M->named_metadata_begin(),
+ E = M->named_metadata_end(); I != E; ++I) {
+ const NamedMDNode &NMD = *I;
+ SmallVector<MDNode*, 4> MDs;
+ for (unsigned i = 0, e = NMD.getNumOperands(); i != e; ++i)
+ MDs.push_back(cast<MDNode>(MapValue(NMD.getOperand(i), ValueMap)));
+ NamedMDNode::Create(New->getContext(), NMD.getName(),
+ MDs.data(), MDs.size(), New);
+ }
return New;
}
More information about the llvm-commits
mailing list