<br><br><div class="gmail_quote">On Mon, Jul 2, 2012 at 9:17 PM, Joerg Sonnenberger <span dir="ltr"><<a href="mailto:joerg@britannica.bec.de" target="_blank">joerg@britannica.bec.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Mon, Jul 02, 2012 at 11:55:31AM +0400, Kostya Serebryany wrote:<br>
> +  for (ListOfGlobals *l = list_of_globals; l; l = l->next) {<br>
> +    //Poison only globals not defined in this TU<br>
> +    if (!IsGlobalInList(globals, n, l->g)){<br>
><br>
> This is N^2, isn't it?<br>
> Even once we get rid of N^2, this will still be not very efficient (due to<br>
> linked list traversal).<br>
> I can live with this for now, but this will need to be fixed before we<br>
> enable the phase.<br>
<br></div></blockquote><div><br></div><div>First, let me remind that asan-rt is not a usual C++ code. </div><div>It can not use malloc/new, and thus STL containers are inaccessible. </div><div>It can allocate memory from raw mmap, but that's costly, so we try not to allocate memory at all :) </div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
</div>Would it possible to build a sorted array of all globals first? </blockquote><div><br></div><div>Why? </div><div>Much simpler is to run through all globals of the current CU and mark them (using a boolean flag member).</div>
<div>This will make the algorithm M+N instead of M*N</div><div>(M=num globals in the current CU, N=num globals in the whole program)</div><div><br></div><div>--kcc </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That<br>
would make the individual check logarithmic and allow more compact<br>
representation in general. A bloom filter might also be a nice<br>
pre-filter.<br>
<br>
Joerg<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br>