Include isFunctionLocal while calculating folding node set profile for a MDNode.

llvm-svn: 99490
This commit is contained in:
Devang Patel 2010-03-25 06:04:47 +00:00
parent 08b3364c6e
commit 4414711909
1 changed files with 14 additions and 13 deletions

View File

@ -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);