This is the mail archive of the gcc-bugs@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]

[Bug middle-end/23971] [4.0/4.1 Regression] synth_mult running amok


------- Additional Comments From kazu at gcc dot gnu dot org  2005-09-20 19:28 -------
On alpha-linux-gnu, synth_mult is called 20 million times.

I've got one idea that might or might not work.

Currently, synth_mult records successful cases in it hash/cache.
That is, if synth_mult determines that "var * N" should be implemented
as "var * log_2 (N-1) + var" for example, synth_mult records that
into one entry of cache.

However, if synth_mult cannot determine the best way to implement "var * N"
with in a given cost limit, it does nothing but return to the caller.

What we can do here is to record failures, saying "I don't know
the best way to implement multiplication by N within cost limit of M."
Then next time synth_mult is asked to find the best way to implmenent
multiplication by N within cost limit of M or less, we know that
we don't have any way of meeting the limit.

For example, in this particular test case, synth_mult is asked to synthesize
multiplication by 3381213428 as many as 14,705 times.
Most of these invocations come with similar cost limits.
So we should be able to save many many recursive calls.

Take 1193369444 as another example.  synth_mult is called with this number
4485 times.  Again, we should be able to save many recursive calls.

I'm going to give this idea a try some time this week.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23971


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