This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for PR tree-optimization/32941, bootstrap comparision failure
- From: Ian Lance Taylor <iant at google dot com>
- To: sje at cup dot hp dot com
- Cc: gcc-patches at gcc dot gnu dot org, andreasmeier80 at gmx dot de
- Date: 10 Aug 2007 09:28:11 -0700
- Subject: Re: Patch for PR tree-optimization/32941, bootstrap comparision failure
- References: <200708101549.IAA02582@hpsje.cup.hp.com>
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