From 4db24cc49beb2fa6659997cbdd07f6b105ce6df7 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Tue, 18 Nov 2014 02:20:29 +0000 Subject: [PATCH] IR: Sink MDNode::Hash down to GenericMDNode::Hash Part of PR21532. llvm-svn: 222212 --- llvm/include/llvm/IR/Metadata.h | 8 +++----- llvm/lib/IR/Metadata.cpp | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h index 6da5b21c923c..a056b0d2973f 100644 --- a/llvm/include/llvm/IR/Metadata.h +++ b/llvm/include/llvm/IR/Metadata.h @@ -164,10 +164,6 @@ protected: llvm_unreachable("Constructor throws?"); } - // TODO: Sink this into GenericMDNode. Can't do this until operands are - // allocated at the front (currently they're at the back). - unsigned Hash; - /// \brief Subclass data enums. enum { /// FunctionLocalBit - This bit is set if this MDNode is function local. @@ -285,8 +281,10 @@ class GenericMDNode : public MDNode { friend class MDNode; friend class LLVMContextImpl; + unsigned Hash; + GenericMDNode(LLVMContext &C, ArrayRef Vals, bool isFunctionLocal) - : MDNode(C, GenericMDNodeVal, Vals, isFunctionLocal) {} + : MDNode(C, GenericMDNodeVal, Vals, isFunctionLocal), Hash(0) {} ~GenericMDNode(); void dropAllReferences(); diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index b4da2e068b8a..27ba9f7a87ba 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -140,7 +140,7 @@ void MDNode::operator delete(void *Mem) { MDNode::MDNode(LLVMContext &C, unsigned ID, ArrayRef Vals, bool isFunctionLocal) - : Metadata(C, ID), Hash(0) { + : Metadata(C, ID) { NumOperands = Vals.size(); if (isFunctionLocal)