summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Metadata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/Metadata.cpp')
-rw-r--r--llvm/lib/IR/Metadata.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 0310ee776c9..fb70149330b 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -403,20 +403,19 @@ MDNode::MDNode(LLVMContext &Context, unsigned ID, StorageType Storage,
for (unsigned I = 0, E = MDs.size(); I != E; ++I)
setOperand(I, MDs[I]);
- if (isTemporary())
- this->Context.makeReplaceable(
- make_unique<ReplaceableMetadataImpl>(Context));
-
- if (!isUniqued())
+ if (isDistinct())
return;
- // Check whether any operands are unresolved, requiring re-uniquing.
- unsigned NumUnresolved = countUnresolvedOperands();
- if (!NumUnresolved)
- return;
+ if (isUniqued()) {
+ // Check whether any operands are unresolved, requiring re-uniquing.
+ unsigned NumUnresolved = countUnresolvedOperands();
+ if (!NumUnresolved)
+ return;
+
+ SubclassData32 = NumUnresolved;
+ }
this->Context.makeReplaceable(make_unique<ReplaceableMetadataImpl>(Context));
- SubclassData32 = NumUnresolved;
}
static bool isOperandUnresolved(Metadata *Op) {
OpenPOWER on IntegriCloud