This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Rewrite reassociation pass
Just a couple more notes on reassociation.
Right now you have a transformation which takes
t = -b;
c = a + t;
And you turn that into
c = a - b;
Which is fine and good. However, you don't do the analogous
transformation when you have:
t = -b;
c = t + a;
This occurs relatively often when "a" is a constant. Clearly
this can be converted into
t = -b;
c = a + t;
Which then turns into
c = a - b
Adding this, is (of course) trivial.
I haven't looked into all the cases, but we actually get
discover fewer redundancies in the final DOM pass when
we run reassociation immediately before. However, we
are able to do detect more simplifications in reassoc,
and in fact some which were missed by final DOM, so
it's probably a wash. [The advantage with the extra
reassoc pass is we can zap the reassoc code in DOM. ]
jeff