[llvm] r263866 - Compute some Debug Info Metadata hash key partially (NFC)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 18 18:11:49 PDT 2016


r263869.

Thanks for the suggestion.

-- 
Mehdi

> On Mar 18, 2016, at 6:07 PM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> Might be worth leaving a comment trail in each of these to explain why only some fields are being hashed?
> 
> On Fri, Mar 18, 2016 at 5:59 PM, Mehdi Amini via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> Author: mehdi_amini
> Date: Fri Mar 18 19:59:26 2016
> New Revision: 263866
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=263866&view=rev <http://llvm.org/viewvc/llvm-project?rev=263866&view=rev>
> Log:
> Compute some Debug Info Metadata hash key partially (NFC)
> 
> Summary:
> This patch changes the computation of the hash key for DISubprogram to
> be computed on a small subset of the fields. The hash is computed a
> lot faster, but there might be more collision in the table.
> However by carefully selecting the fields, colisions should be rare.
> 
> Using `opt` to load the IR for FastISelEmitter.cpp.o, with this patch:
>  - DISubprogram::getImpl() goes from 28ms to 15ms.
>  - DICompositeType::getImpl() goes from 6ms to 2ms
>  - DIDerivedType::getImpl() goes from 18 to 12ms
> 
> Reviewers: dexonsmith
> 
> Subscribers: llvm-commits
> 
> Differential Revision: http://reviews.llvm.org/D16571 <http://reviews.llvm.org/D16571>
> 
> From: Mehdi Amini <mehdi.amini at apple.com <mailto:mehdi.amini at apple.com>>
> 
> Modified:
>     llvm/trunk/lib/IR/LLVMContextImpl.h
> 
> Modified: llvm/trunk/lib/IR/LLVMContextImpl.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.h?rev=263866&r1=263865&r2=263866&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.h?rev=263866&r1=263865&r2=263866&view=diff>
> ==============================================================================
> --- llvm/trunk/lib/IR/LLVMContextImpl.h (original)
> +++ llvm/trunk/lib/IR/LLVMContextImpl.h Fri Mar 18 19:59:26 2016
> @@ -365,8 +365,7 @@ template <> struct MDNodeKeyImpl<DIDeriv
>             ExtraData == RHS->getRawExtraData();
>    }
>    unsigned getHashValue() const {
> -    return hash_combine(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
> -                        AlignInBits, OffsetInBits, Flags, ExtraData);
> +    return hash_combine(Tag, Name, File, Line, Scope, BaseType, Flags);
>    }
>  };
> 
> @@ -422,9 +421,8 @@ template <> struct MDNodeKeyImpl<DICompo
>             Identifier == RHS->getIdentifier();
>    }
>    unsigned getHashValue() const {
> -    return hash_combine(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
> -                        AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
> -                        VTableHolder, TemplateParams, Identifier);
> +    return hash_combine(Name, File, Line, BaseType, Scope, Elements,
> +                        TemplateParams);
>    }
>  };
> 
> @@ -518,10 +516,7 @@ template <> struct MDNodeKeyImpl<DISubpr
>             Variables == RHS->getRawVariables();
>    }
>    unsigned getHashValue() const {
> -    return hash_combine(Scope, Name, LinkageName, File, Line, Type,
> -                        IsLocalToUnit, IsDefinition, ScopeLine, ContainingType,
> -                        Virtuality, VirtualIndex, Flags, IsOptimized,
> -                        TemplateParams, Declaration, Variables);
> +    return hash_combine(Name, Scope, File, Type, Line);
>    }
>  };
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160318/0bdcfd00/attachment.html>


More information about the llvm-commits mailing list