This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: postreload-gcse heuristics broken?
- From: Mostafa Hagog <MUSTAFA at il dot ibm dot com>
- To: Ulrich Weigand <Ulrich dot Weigand at de dot ibm dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 24 Jan 2005 13:56:15 +0200
- Subject: Re: postreload-gcse heuristics broken?
gcc-owner@gcc.gnu.org wrote on 20/01/2005 21:26:22:
> Hello,
>
> the heuristics used in eliminate_partially_redundant_load
> (postreload-gcse.c) to decide whether or not eliminating
> a redundancy appears to be seriously broken. It tests
>
> /* Check if it's worth applying the partial redundancy elimination. */
> if (ok_count < GCSE_AFTER_RELOAD_PARTIAL_FRACTION * not_ok_count)
> goto cleanup;
> if (ok_count < GCSE_AFTER_RELOAD_CRITICAL_FRACTION * critical_count)
> goto cleanup;
>
> where the counts are accumulated edge->count values, e.g.
>
> if (EDGE_CRITICAL_P (pred))
> critical_count += pred->count;
>
> Unfortunately it would appear that unless profile-directed
> feedback is being used, edge->count is always zero!
>
> Thus the check above always reduced to 0 < 0, and therefore
> *every possible* redundancy elimination is performed, resulting
> in much worse code than before in some cases.
>
> Any suggestions how the heuristics can be fixed in the
> absence of profile data? Otherwise, I'd suggest to make
> the pass conditional on profile-directed feedback ...
The underlying assumption to the above heuristic is that even without
profile information the edge->count is estimated according to the branch
probabilities, which seems to be wrong.
Mostafa.
>
> Bye,
> Ulrich
>
> --
> Dr. Ulrich Weigand
> Linux on zSeries Development
> Ulrich.Weigand@de.ibm.com