<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">The hash should (almost?) never change.<div class="">I thought about this solution, and I plan on evaluating it a well (it applies to constants as well). </div><div class="">However there is a tradeoff of memory vs speed doing this.</div><div class="">For instance when doing LTO, we load a lot of metadata when loading and linking individual Modules, which put a lot of stress on the hash tables (both uniquing and grow). But then during optimization and CodeGen it shouldn’t and I’m not sure we want to pay the price of the memory overhead then.</div><div class=""><br class=""></div><div class="">Note also that a ThinLTO link of `opt` right now involves loading ~30000 bitcode files, so it is roughly 30s CPU time overall for the link time for each millisecond saved for each file loaded :)</div><div class=""><br class=""></div><div class="">Let me know if you have any other suggestion!</div><div class=""><br class=""></div><div class="">— </div><div class="">Mehdi</div><div class=""><br class=""></div><div class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 26, 2016, at 1:57 PM, Daniel Berlin <<a href="mailto:dberlin@dberlin.org" class="">dberlin@dberlin.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">How often does the hash change?<br class=""><div class="">If it's really speed important, you could:</div><div class="">A. store the hash value</div><div class="">B. update it when fields change.</div><div class=""><br class=""></div></div><div class="gmail_extra" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""><div class="gmail_quote">On Tue, Jan 26, 2016 at 1:23 AM, Mehdi AMINI via llvm-commits<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">joker.eph created this revision.<br class="">joker.eph added a reviewer: dexonsmith.<br class="">joker.eph added a subscriber: llvm-commits.<br class=""><br class="">This patch changes the computation of the hash key for DISubprogram to<br class="">be computed on a small subset of the fields. The hash is computed a<br class="">lot faster, but there might be more collision in the table.<br class="">However by carefully selecting the fields, colisions should be rare.<br class=""><br class="">Using `opt` to load the IR for FastISelEmitter.cpp.o, this patch<br class="">improves DISubprogram::getImpl() runtime from 28ms to 15ms.<br class=""><br class=""><a href="http://reviews.llvm.org/D16571" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D16571</a><br class=""><br class="">Files:<br class=""> <span class="Apple-converted-space"> </span>lib/IR/LLVMContextImpl.h<br class=""><br class="">Index: lib/IR/LLVMContextImpl.h<br class="">===================================================================<br class="">--- lib/IR/LLVMContextImpl.h<br class="">+++ lib/IR/LLVMContextImpl.h<br class="">@@ -519,10 +519,7 @@<br class=""> <span class="Apple-converted-space"> </span>Variables == RHS->getRawVariables();<br class=""> }<br class=""> unsigned getHashValue() const {<br class="">- return hash_combine(Scope, Name, LinkageName, File, Line, Type,<br class="">- IsLocalToUnit, IsDefinition, ScopeLine, ContainingType,<br class="">- Virtuality, VirtualIndex, Flags, IsOptimized,<br class="">- TemplateParams, Declaration, Variables);<br class="">+ return hash_combine(Scope, File, Type, Line);<br class=""> }<br class=""> };<br class=""><br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a></blockquote></div></div></div></blockquote></div><br class=""></div></div></body></html>