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