This is the mail archive of the 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: Handle a + ~a in reassoc

On Wed, 14 Apr 2010, Richard Guenther wrote:

> On Tue, Apr 13, 2010 at 5:19 PM, Alexander Monakov <> wrote:
> > Hi,
> >
> > This implements folding of (a + ~a) in tree-ssa-reassoc.c. ?As the testcase
> > suggests, this should slightly clean up Fortran code after iv-opts
> > (unfortunately, it only helps in relatively simple cases since reassoc does
> > not touch operands with multiple uses).
> >
> > Bootstrapped and regtested on x86_64-linux. ?OK for trunk?
> A better place for this kind of tree-combining is tree-ssa-forwprop.c
> where we already do similar kinds of tricks (and are not limited to
> single uses).

I looked into tree-ssa-forwprop when you mentioned it on IRC and I decided
against implementing it there, since it would fold only if b = ~a is used in
c = a + b.  This is enough for 2-dimensional arrays (like in the testcase),
but doing similar folding for 3-dimensional arrays and higher requires
examining the whole chain of additions like in reassoc.

Alexander Monakov

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