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

Chris Lattner clattner at apple.com
Wed Mar 24 23:06:05 PDT 2010


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?

-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