[llvm-commits] [llvm] r84878 - in /llvm/trunk: include/llvm/Metadata.h lib/VMCore/Metadata.cpp

Chris Lattner clattner at apple.com
Thu Oct 22 14:28:55 PDT 2009


On Oct 22, 2009, at 10:40 AM, Devang Patel wrote:

> Author: dpatel
> Date: Thu Oct 22 12:40:37 2009
> New Revision: 84878
>
> URL: http://llvm.org/viewvc/llvm-project?rev=84878&view=rev
> Log:
> Sort handler names to ensure deterministic behavior.

Please don't use std::sort.  It is both much slower and bigger than  
using the simple loop I suggested.

-Chris

>
> Modified:
>    llvm/trunk/include/llvm/Metadata.h
>    llvm/trunk/lib/VMCore/Metadata.cpp
>
> Modified: llvm/trunk/include/llvm/Metadata.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Metadata.h?rev=84878&r1=84877&r2=84878&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/include/llvm/Metadata.h (original)
> +++ llvm/trunk/include/llvm/Metadata.h Thu Oct 22 12:40:37 2009
> @@ -285,9 +285,9 @@
>   /// the same metadata to In2.
>   void copyMD(Instruction *In1, Instruction *In2);
>
> -  /// getHandlerNames - Get handler names. This is used by bitcode
> -  /// writer.
> -  void getHandlerNames(SmallVectorImpl<std::pair<unsigned,  
> StringRef> >&N) const;
> +  /// getHandlerNames - Populate client supplied smallvector using  
> custome
> +  /// metadata name and ID.
> +  void getHandlerNames(SmallVectorImpl<std::pair<unsigned,  
> StringRef> >&) const;
>
>   /// ValueIsDeleted - This handler is used to update metadata store
>   /// when a value is deleted.
>
> Modified: llvm/trunk/lib/VMCore/Metadata.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=84878&r1=84877&r2=84878&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/VMCore/Metadata.cpp (original)
> +++ llvm/trunk/lib/VMCore/Metadata.cpp Thu Oct 22 12:40:37 2009
> @@ -304,13 +304,14 @@
>   return &I->second;
> }
>
> -/// getHandlerNames - Get handler names. This is used by bitcode
> -/// writer and aswm writer.
> +/// getHandlerNames - Populate client supplied smallvector using  
> custome
> +/// metadata name and ID.
> void MetadataContext::
> getHandlerNames(SmallVectorImpl<std::pair<unsigned, StringRef>  
> >&Names) const {
>   for (StringMap<unsigned>::const_iterator I = MDHandlerNames.begin(),
>          E = MDHandlerNames.end(); I != E; ++I)
>     Names.push_back(std::make_pair(I->second, I->first()));
> +  std::sort(Names.begin(), Names.end());
> }
>
> /// ValueIsCloned - This handler is used to update metadata store
>
>
> _______________________________________________
> 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