mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-17 06:33:21 +00:00
Utils: Extract cloneMDTuple(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225912 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cc1ea9cb4d
commit
6f73d6fd4c
@ -219,6 +219,19 @@ static bool shouldRemapUniquedNode(const UniquableMDNode *Node,
|
||||
return false;
|
||||
}
|
||||
|
||||
static Metadata *cloneMDTuple(const UniquableMDNode *Node,
|
||||
ValueToValueMapTy &VM, RemapFlags Flags,
|
||||
ValueMapTypeRemapper *TypeMapper,
|
||||
ValueMaterializer *Materializer) {
|
||||
SmallVector<Metadata *, 4> Elts;
|
||||
Elts.reserve(Node->getNumOperands());
|
||||
for (unsigned I = 0, E = Node->getNumOperands(); I != E; ++I)
|
||||
Elts.push_back(mapMetadataOp(Node->getOperand(I), VM, Flags, TypeMapper,
|
||||
Materializer));
|
||||
|
||||
return MDTuple::get(Node->getContext(), Elts);
|
||||
}
|
||||
|
||||
/// \brief Map a uniqued MDNode.
|
||||
///
|
||||
/// Uniqued nodes may not need to be recreated (they may map to themselves).
|
||||
@ -241,13 +254,7 @@ static Metadata *mapUniquedNode(const UniquableMDNode *Node,
|
||||
}
|
||||
|
||||
// At least one operand needs remapping.
|
||||
SmallVector<Metadata *, 4> Elts;
|
||||
Elts.reserve(Node->getNumOperands());
|
||||
for (unsigned I = 0, E = Node->getNumOperands(); I != E; ++I)
|
||||
Elts.push_back(mapMetadataOp(Node->getOperand(I), VM, Flags, TypeMapper,
|
||||
Materializer));
|
||||
|
||||
MDNode *NewMD = MDTuple::get(Node->getContext(), Elts);
|
||||
Metadata *NewMD = cloneMDTuple(Node, VM, Flags, TypeMapper, Materializer);
|
||||
Dummy->replaceAllUsesWith(NewMD);
|
||||
MDNode::deleteTemporary(Dummy);
|
||||
return mapToMetadata(VM, Node, NewMD);
|
||||
|
Loading…
x
Reference in New Issue
Block a user