On Tue, 2011-10-11 at 09:12 -0500, William J. Schmidt wrote: > > The pattern matching is still very ad-hoc and doesn't consider > > statements that feed the base address. There is conceptually > > no difference between p->a[n] and *(p + n * 4). > > That's true. Since we abandoned the general address-lowering approach, > this was aimed at the specific pattern that comes up frequently in > practice. I would expect the *(p + n * 4) cases to be handled by the > general straight-line strength reduction, which is the correct long-term > approach. (Cases like p->a[n], where the multiplication is not yet > explicit, will be a bit of a wart as part of strength reduction, too, > but that's still the right place for it eventually.)
Going through my notes, I do have some code for the *(p + n * 4) case lying around from the last time I tried this in expand, so I'll try to get this back in place (either in reassoc2 or expand, depending on how the CSE works out).