[llvm] r225918 - Utils: Thread distinct-ness through the cloneMD*() functions, NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Tue Jan 13 17:24:38 PST 2015
Author: dexonsmith
Date: Tue Jan 13 19:24:38 2015
New Revision: 225918
URL: http://llvm.org/viewvc/llvm-project?rev=225918&view=rev
Log:
Utils: Thread distinct-ness through the cloneMD*() functions, NFC
The new logic isn't actually reachable yet, so no functionality change.
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=225918&r1=225917&r2=225918&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp Tue Jan 13 19:24:38 2015
@@ -183,21 +183,24 @@ static Metadata *mapMetadataOp(Metadata
static Metadata *cloneMDTuple(const MDTuple *Node, ValueToValueMapTy &VM,
RemapFlags Flags,
ValueMapTypeRemapper *TypeMapper,
- ValueMaterializer *Materializer) {
+ ValueMaterializer *Materializer,
+ bool IsDistinct) {
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);
+ return (IsDistinct ? MDTuple::getDistinct : MDTuple::get)(Node->getContext(),
+ Elts);
}
static Metadata *cloneMDLocation(const MDLocation *Node, ValueToValueMapTy &VM,
RemapFlags Flags,
ValueMapTypeRemapper *TypeMapper,
- ValueMaterializer *Materializer) {
- return MDLocation::get(
+ ValueMaterializer *Materializer,
+ bool IsDistinct) {
+ return (IsDistinct ? MDLocation::getDistinct : MDLocation::get)(
Node->getContext(), Node->getLine(), Node->getColumn(),
mapMetadataOp(Node->getScope(), VM, Flags, TypeMapper, Materializer),
mapMetadataOp(Node->getInlinedAt(), VM, Flags, TypeMapper, Materializer));
@@ -205,14 +208,14 @@ static Metadata *cloneMDLocation(const M
static Metadata *cloneMDNode(const UniquableMDNode *Node, ValueToValueMapTy &VM,
RemapFlags Flags, ValueMapTypeRemapper *TypeMapper,
- ValueMaterializer *Materializer) {
+ ValueMaterializer *Materializer, bool IsDistinct) {
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); \
+ Materializer, IsDistinct); \
break;
#include "llvm/IR/Metadata.def"
}
@@ -279,7 +282,8 @@ static Metadata *mapUniquedNode(const Un
}
// At least one operand needs remapping.
- Metadata *NewMD = cloneMDNode(Node, VM, Flags, TypeMapper, Materializer);
+ Metadata *NewMD = cloneMDNode(Node, VM, Flags, TypeMapper, Materializer,
+ /* IsDistinct */ false);
Dummy->replaceAllUsesWith(NewMD);
MDNode::deleteTemporary(Dummy);
return mapToMetadata(VM, Node, NewMD);
More information about the llvm-commits
mailing list