From f906cb933e4daa4b77c27941365b79cca1b697e9 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 25 Mar 2010 06:04:47 +0000 Subject: [PATCH] Include isFunctionLocal while calculating folding node set profile for a MDNode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99490 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Metadata.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp index a6e20283898..69db83e2364 100644 --- a/lib/VMCore/Metadata.cpp +++ b/lib/VMCore/Metadata.cpp @@ -182,19 +182,6 @@ MDNode *MDNode::getMDNode(LLVMContext &Context, Value *const *Vals, unsigned NumVals, FunctionLocalness FL, bool Insert) { LLVMContextImpl *pImpl = Context.pImpl; - FoldingSetNodeID ID; - for (unsigned i = 0; i != NumVals; ++i) - ID.AddPointer(Vals[i]); - - void *InsertPoint; - MDNode *N = NULL; - - if ((N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint))) - return N; - - if (!Insert) - return NULL; - bool isFunctionLocal = false; switch (FL) { case FL_Unknown: @@ -216,6 +203,20 @@ MDNode *MDNode::getMDNode(LLVMContext &Context, Value *const *Vals, break; } + FoldingSetNodeID ID; + for (unsigned i = 0; i != NumVals; ++i) + ID.AddPointer(Vals[i]); + ID.AddBoolean(isFunctionLocal); + + void *InsertPoint; + MDNode *N = NULL; + + if ((N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint))) + return N; + + if (!Insert) + return NULL; + // Coallocate space for the node and Operands together, then placement new. void *Ptr = malloc(sizeof(MDNode)+NumVals*sizeof(MDNodeOperand)); N = new (Ptr) MDNode(Context, Vals, NumVals, isFunctionLocal); -- 2.34.1