Steven Bosscher <stevenb....@gmail.com> writes: > On Sun, Mar 15, 2009 at 11:19 PM, Ramana Radhakrishnan > <raman...@gmail.com> wrote: >> I'm not sure about the best way to fix this but I've filed this for >> the moment as >> >> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39468 > > This problem is reported every once in a while, all targets with small > load-immediate instructions suffer from this, especially since GCC 4.0 > (i.e. since tree-ssa). But it seems there is just not enough interest > in having it fixed somehow, or someone would have taken care of it by > now. > > I've summed up before how the problem _could_ be fixed, but I can't > find where. So here we go again. > > This could be solved in CSE by extending the notion of "related > expressions" to constants that can be generated from other constants > by a shift. Alternatively, you could create a simple, separate pass > that applies CSE's "related expressions" thing in dominator tree walk.
See http://gcc.gnu.org/ml/gcc-patches/2009-03/msg00158.html for handling something similar when related expressions differ by a small additive constant. I am planning to finish this and submit it for 4.5. Adam