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] PR/27733, synth_mult cache missing too much


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


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