Commit fdb1c7b3 by Jan Hubicka Committed by Jan Hubicka

emit-rtl.c (change_address, [...]): Return early when there is nothing to change.

	* emit-rtl.c (change_address, adjust_address_1, offset_address,
	widen_memory_access):  Return early when there is nothing to change.

From-SVN: r76512
parent 8865bf80
2004-01-24 Jan Hubicka <jh@suse.cz>
* emit-rtl.c (change_address, adjust_address_1, offset_address,
widen_memory_access): Return early when there is nothing to change.
2004-01-24 Jakub Jelinek <jakub@redhat.com> 2004-01-24 Jakub Jelinek <jakub@redhat.com>
* simplify-rtx.c (simplify_relational_operation): Don't * simplify-rtx.c (simplify_relational_operation): Don't
......
...@@ -1872,6 +1872,10 @@ change_address (rtx memref, enum machine_mode mode, rtx addr) ...@@ -1872,6 +1872,10 @@ change_address (rtx memref, enum machine_mode mode, rtx addr)
rtx new = change_address_1 (memref, mode, addr, 1); rtx new = change_address_1 (memref, mode, addr, 1);
enum machine_mode mmode = GET_MODE (new); 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) MEM_ATTRS (new)
= get_mem_attrs (MEM_ALIAS_SET (memref), 0, 0, = get_mem_attrs (MEM_ALIAS_SET (memref), 0, 0,
mmode == BLKmode ? 0 : GEN_INT (GET_MODE_SIZE (mmode)), mmode == BLKmode ? 0 : GEN_INT (GET_MODE_SIZE (mmode)),
...@@ -1898,6 +1902,11 @@ adjust_address_1 (rtx memref, enum machine_mode mode, HOST_WIDE_INT offset, ...@@ -1898,6 +1902,11 @@ adjust_address_1 (rtx memref, enum machine_mode mode, HOST_WIDE_INT offset,
rtx size = 0; rtx size = 0;
unsigned int memalign = MEM_ALIGN (memref); unsigned int memalign = MEM_ALIGN (memref);
/* If there are no changes, just return the original memory reference. */
if (mode == GET_MODE (memref) && !offset
&& (!validate || memory_address_p (mode, addr)))
return memref;
/* ??? Prefer to create garbage instead of creating shared rtl. /* ??? Prefer to create garbage instead of creating shared rtl.
This may happen even if offset is nonzero -- consider This may happen even if offset is nonzero -- consider
(plus (plus reg reg) const_int) -- so do this always. */ (plus (plus reg reg) const_int) -- so do this always. */
...@@ -1988,6 +1997,10 @@ offset_address (rtx memref, rtx offset, unsigned HOST_WIDE_INT pow2) ...@@ -1988,6 +1997,10 @@ offset_address (rtx memref, rtx offset, unsigned HOST_WIDE_INT pow2)
update_temp_slot_address (XEXP (memref, 0), new); update_temp_slot_address (XEXP (memref, 0), new);
new = change_address_1 (memref, VOIDmode, new, 1); new = change_address_1 (memref, VOIDmode, new, 1);
/* If there are no changes, just return the original memory reference. */
if (new == memref)
return new;
/* Update the alignment to reflect the offset. Reset the offset, which /* Update the alignment to reflect the offset. Reset the offset, which
we don't know. */ we don't know. */
MEM_ATTRS (new) MEM_ATTRS (new)
...@@ -2032,6 +2045,10 @@ widen_memory_access (rtx memref, enum machine_mode mode, HOST_WIDE_INT offset) ...@@ -2032,6 +2045,10 @@ widen_memory_access (rtx memref, enum machine_mode mode, HOST_WIDE_INT offset)
rtx memoffset = MEM_OFFSET (new); rtx memoffset = MEM_OFFSET (new);
unsigned int size = GET_MODE_SIZE (mode); unsigned int size = GET_MODE_SIZE (mode);
/* If there are no changes, just return the original memory reference. */
if (new == memref)
return new;
/* If we don't know what offset we were at within the expression, then /* If we don't know what offset we were at within the expression, then
we can't know if we've overstepped the bounds. */ we can't know if we've overstepped the bounds. */
if (! memoffset) if (! memoffset)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment