postreload-gcse heuristics broken?

Ulrich Weigand uweigand@de.ibm.com
Thu Jan 20 20:13:00 GMT 2005


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 ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  Linux on zSeries Development
  Ulrich.Weigand@de.ibm.com



More information about the Gcc mailing list