[llvm] r225917 - Utils: Extract cloneMDNode(), NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Tue Jan 13 17:22:47 PST 2015
Author: dexonsmith
Date: Tue Jan 13 19:22:47 2015
New Revision: 225917
URL: http://llvm.org/viewvc/llvm-project?rev=225917&view=rev
Log:
Utils: Extract cloneMDNode(), NFC
Modified:
llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp
Modified: llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp?rev=225917&r1=225916&r2=225917&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp Tue Jan 13 19:22:47 2015
@@ -203,6 +203,21 @@ static Metadata *cloneMDLocation(const M
mapMetadataOp(Node->getInlinedAt(), VM, Flags, TypeMapper, Materializer));
}
+static Metadata *cloneMDNode(const UniquableMDNode *Node, ValueToValueMapTy &VM,
+ RemapFlags Flags, ValueMapTypeRemapper *TypeMapper,
+ ValueMaterializer *Materializer) {
+ switch (Node->getMetadataID()) {
+ default:
+ llvm_unreachable("Invalid UniquableMDNode subclass");
+#define HANDLE_UNIQUABLE_LEAF(CLASS) \
+ case Metadata::CLASS##Kind: \
+ return clone##CLASS(cast<CLASS>(Node), VM, Flags, TypeMapper, \
+ Materializer); \
+ break;
+#include "llvm/IR/Metadata.def"
+ }
+}
+
/// \brief Map a distinct MDNode.
///
/// Distinct nodes are not uniqued, so they must always recreated.
@@ -264,17 +279,7 @@ static Metadata *mapUniquedNode(const Un
}
// At least one operand needs remapping.
- Metadata *NewMD;
- switch (Node->getMetadataID()) {
- default:
- llvm_unreachable("Invalid UniquableMDNode subclass");
-#define HANDLE_UNIQUABLE_LEAF(CLASS) \
- case Metadata::CLASS##Kind: \
- NewMD = \
- clone##CLASS(cast<CLASS>(Node), VM, Flags, TypeMapper, Materializer); \
- break;
-#include "llvm/IR/Metadata.def"
- }
+ Metadata *NewMD = cloneMDNode(Node, VM, Flags, TypeMapper, Materializer);
Dummy->replaceAllUsesWith(NewMD);
MDNode::deleteTemporary(Dummy);
return mapToMetadata(VM, Node, NewMD);
More information about the llvm-commits
mailing list