[llvm-commits] [llvm] r99490 - /llvm/trunk/lib/VMCore/Metadata.cpp

Devang Patel dpatel at apple.com
Wed Mar 24 23:15:33 PDT 2010


On Mar 24, 2010, at 11:06 PM, Chris Lattner wrote:

> 
> On Mar 24, 2010, at 11:04 PM, Devang Patel wrote:
> 
>> Author: dpatel
>> Date: Thu Mar 25 01:04:47 2010
>> New Revision: 99490
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=99490&view=rev
>> Log:
>> Include isFunctionLocal while calculating folding node set profile for a MDNode.
> 
> Can this code call MDNode::Profile instead of duplicating it?

MDNode::getMDNode() calculates profile based on incoming value list before creating MDNode. 
-
Devang
> 
> -Chris
> 
>> 
>> 
>> Modified:
>>   llvm/trunk/lib/VMCore/Metadata.cpp
>> 
>> Modified: llvm/trunk/lib/VMCore/Metadata.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=99490&r1=99489&r2=99490&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/VMCore/Metadata.cpp (original)
>> +++ llvm/trunk/lib/VMCore/Metadata.cpp Thu Mar 25 01:04:47 2010
>> @@ -182,19 +182,6 @@
>>                          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 @@
>>    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);
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 





More information about the llvm-commits mailing list