[PATCH] PR/27733, synth_mult cache missing too much

Kazu Hirata kazu@codesourcery.com
Thu Jun 8 14:21:00 GMT 2006


Hi Paolo,

> However, all this very effective and appreciated hacking of synth_mult 
> had a little oversight:
> 
> /* The entry for our multiplication cache/hash table.  */
> struct alg_hash_entry {
>  /* The number we are multiplying by.  */
>  unsigned int t;
>  ...
> 
> 
> Gotcha!  :-P  The factor is stored as a 32-bit value only, while the 
> argument of synth_mult is a HOST_WIDE_INT.  While this could even be the 
> cause of a wrong-code regression, this is extremely unlikely to happen.  
> It is more likely, even in real-world cases like PR27733, that it causes 
> a *lot* of cache misses.  In fact, the PR is almost fixed by changing 
> the type of this field.

This is a good catch.

I don't think wrong code can be generated because I check for the following.

   /* See if we already know what to do for T.  */
   if (alg_hash[hash_index].t == t

While I don't think wrong code is possible, the cache doesn't do any good for 
numbers that do not fit in unsigned int.

Kazu Hirata



More information about the Gcc-patches mailing list