This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[4.2]: Rewrite reassociation
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 08 Sep 2005 10:26:35 -0400
- Subject: [4.2]: Rewrite reassociation
This rewrites the reassociation pass, so that it catches a lot more
cases, and properly handles recursive expressions. In the process, it
turns off auto-canonicalization of expressions in get_expr_operands, and
moves it to DOM, which is the only thing that cared (SPEC/other tests
show absolutely no difference in performance with or without the
canonicalization)
It fixes a few missed optimization bugs, like PR 15878, 16157, and
reassoc-2.c.
It's faster than the old reassociation pass, but still could be made
faster.
It's also got quite a bit of dumping code in it (In fact, it probably
has more code related to dumping expressions that code that does stuff.
In part because we have no easy way to print out expressions, etc, in
the middle of messages like we do with warnings and errors)
I'm posting this patch mainly so i don't lose it before 4.2.
Some of the dumping info is useless, and will be removed before "really"
submitting it. You could also go down the path of making even better
decisions about how to rewrite the expressions, as described at the top
of the file (I've #if 0'd the beginnings of this), but i don't plan on
doing that.
If someone thinks we want this for 4.1, i'll clean it up.
I've included a bunch of new testcases to make sure we optimize them
right, and modified ssa-pre-2.c to note that we get an additional
elimination.
Overall, this causes PRE to be a bit more effective. Over a bootstrap
of GCC, it eliminates roughly 5% more things than it used to.
(This was also a prelude to fixing PR 23619).
Compile time is neutral.
Bootstrapped and regtested on i686-pc-linux-gnu.
--Dan