This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Avoid unnecesary MEM RTXes
> On Fri, Jan 23, 2004 at 08:00:54PM +0100, Jan Hubicka wrote:
> > Would be possible to consider the trivial change in emit-rtl preapproved
> > if it passes?
>
> Yes.
Testing has passed and I am about to commit the attached patch.
Honza
2004-01-23 Jan Hubicka <jh@suse.cz>
* emit-rtl.c (change_address_1): Do not re-generate the RTX if nothing
change.
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.367
diff -c -3 -p -r1.367 emit-rtl.c
*** emit-rtl.c 20 Jan 2004 22:16:59 -0000 1.367
--- emit-rtl.c 23 Jan 2004 19:31:18 -0000
*************** change_address_1 (rtx memref, enum machi
*** 1840,1845 ****
--- 1840,1848 ----
mode = GET_MODE (memref);
if (addr == 0)
addr = XEXP (memref, 0);
+ if (mode == GET_MODE (memref) && addr == XEXP (memref, 0)
+ && (!validate || memory_address_p (mode, addr)))
+ return memref;
if (validate)
{