diff options
Diffstat (limited to 'llvm/lib/VMCore/Metadata.cpp')
-rw-r--r-- | llvm/lib/VMCore/Metadata.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Metadata.cpp b/llvm/lib/VMCore/Metadata.cpp index 55de0dc6515..090b09a4ccd 100644 --- a/llvm/lib/VMCore/Metadata.cpp +++ b/llvm/lib/VMCore/Metadata.cpp @@ -250,6 +250,9 @@ MDNode *MDNode::getMDNode(LLVMContext &Context, ArrayRef<Value*> Vals, void *Ptr = malloc(sizeof(MDNode)+Vals.size()*sizeof(MDNodeOperand)); N = new (Ptr) MDNode(Context, Vals, isFunctionLocal); + // Cache the operand hash. + N->Hash = ID.ComputeHash(); + // InsertPoint will have been set by the FindNodeOrInsertPos call. pImpl->MDNodeSet.InsertNode(N, InsertPoint); @@ -373,6 +376,8 @@ void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) { return; } + // Cache the operand hash. + Hash = ID.ComputeHash(); // InsertPoint will have been set by the FindNodeOrInsertPos call. pImpl->MDNodeSet.InsertNode(this, InsertPoint); |