This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix PR37053: Move tweaks of commutative precedence to target hook
- From: Maxim Kuvyrkov <maxim at codesourcery dot com>
- To: Paolo Bonzini <paolo dot bonzini at gmail dot com>
- Cc: Peter Bergner <bergner at vnet dot ibm dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Paolo Bonzini <bonzini at gnu dot org>, Ian Lance Taylor <iant at google dot com>, Luis Machado <luisgpm at linux dot ibm dot com>
- Date: Fri, 26 Jun 2009 20:57:30 +0400
- Subject: Re: [PATCH] Fix PR37053: Move tweaks of commutative precedence to target hook
- References: <4A44D817.firstname.lastname@example.org> <1246031128.5284.45.camel@otta> <4A44FA19.email@example.com>
Paolo Bonzini wrote:
I cannot say I like Maxim's patch and he knows, but unfortunately, m68k
apparently implements 2-address arithmetic in a different way than x86
(or with other constraint) and we're talking about a lot of ICEs there. :-(
Another possibility, which you would have to try on PowerPC, could be to
limit the change of precedence to before reload.
Here is the other patch. It has a downside that *during* and after
reload the optimal for PowerPC commutativeness is not available, so that
may degrade performance.
Peter, if you find out that this patch doesn't cause any performance
problems, I'm happy to go with it.
--- gcc-mainline/gcc/rtlanal.c (revision 148831)
+++ gcc-mainline/gcc/rtlanal.c (working copy)
@@ -2936,8 +2936,9 @@ commutative_operand_precedence (rtx op)
/* Complex expressions should be the first, so decrease priority
of objects. Prefer pointer objects over non pointer objects. */
- if ((REG_P (op) && REG_POINTER (op))
- || (MEM_P (op) && MEM_POINTER (op)))
+ if ((!reload_completed && !reload_in_progress)
+ && ((REG_P (op) && REG_POINTER (op))
+ || (MEM_P (op) && MEM_POINTER (op))))
That would be a
simpler patch and one that does not risk slowing down the compiler that
tiny 0.1% that sums up quickly. But it would also be pretty magical...
That's just a check for a global variable to be NULL on most platforms;
btw, the above patch checks two global variables ;). On PowerPC the
extra work is justified with performance boost.