On Thu, 2011-10-06 at 11:35 -0600, Jeff Law wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 10/06/11 04:13, Richard Guenther wrote: > > > > > People have already commented on pieces, so I'm looking only at the > > tree-ssa-reassoc.c pieces (did you consider piggy-backing on IVOPTs > > instead? The idea is to expose additional CSE opportunities, > > right? So it's sort-of a strength-reduction optimization on scalar > > code (classically strength reduction in loops transforms for (i) { > > z = i*x; } to z = 0; for (i) { z += x }). That might be worth in > > general, even for non-address cases. So - if you rename that thing > > to tree-ssa-strength-reduce.c you can get away without > > piggy-backing on anything ;) If you structure it to detect a > > strength reduction opportunity (thus, you'd need to match > > two/multiple of the patterns at the same time) that would be a > > bonus ... generalizing it a little bit would be another. > There's a variety of literature that uses PRE to detect and optimize > straightline code strength reduction. I poked at it at one time (RTL > gcse framework) and it looked reasonably promising. Never pushed it > all the way through. > > jeff
I ran across http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22586 and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35308 that show this question has come up before. The former also suggested a PRE-based approach.