This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch for PR tree-optimization/32941, bootstrap comparision failure


Steve Ellcey <sje@cup.hp.com> writes:

> This patch fixes PR tree-optimization/32941, a bootstrap comparision
> failure.  Currently we sort the goto_queue in tree-eh.c using qsort and
> search it with bsearch.  Because qsort is an unstable sort and we are
> sorting on addresses we can get different orderings during different
> bootstrap passes, resulting in the comparision failure.
> 
> This patch removes the sort and replaces the bsearch call with a simple
> linear search.  The obvious concern with this is compile time
> performance but during a bootstrap the largest size goto_queue I saw was
> 7 elements and while compiling the C++ SPEC2006 benchmarks, the largest
> size I saw was 30.
> 
> Given these relatively small sizes for the goto_queue, I think using a
> linear search will not result in any compile time change or may actually
> be faster since 99% of the time we search the queue the size is 1.

I don't think this is a good idea.  I think it will significantly hurt
compiler time performance on some machine generated C++ code.

I think the idea of not sorting the queue makes sense.  I just think
we need to augment your patch by adding a pointer_map which maps from
statements to queue elements.  That is, maybe_record_in_goto_queue
will call pointer_map_insert with STMT, and find_goto_replacement will
call pointer_map_contains.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]