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: Avoid unnecesary MEM RTXes

On Fri, Jan 23, 2004 at 11:18:53AM -0800, Richard Henderson wrote:
> 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.

Is following change ok?
Previously, mem = change_address (mem, VOIDmode, XEXP (mem, 0));
changed mem to loose offset/alignment information, now it will be a nop.
I'm now looking into the IA-32 stringops and this is something I need to do
there if the count is not constant.  I thought calling get_mem_attrs
directly was supposed to be avoided.

@@ -1869,6 +1872,10 @@ change_address (rtx memref, enum machine
   rtx new = change_address_1 (memref, mode, addr, 1);
   enum machine_mode mmode = GET_MODE (new);

+  /* If there are no changes, just return the original memory reference.  */
+  if (new == memref)
+    return new;
   MEM_ATTRS (new)
     = get_mem_attrs (MEM_ALIAS_SET (memref), 0, 0,
                     mmode == BLKmode ? 0 : GEN_INT (GET_MODE_SIZE (mmode)),


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