emit-rtl.c (adjust_address_1): Don't adjust address if adjust is false.
authorRichard Henderson <rth@redhat.com>
Thu, 13 Dec 2001 17:50:02 +0000 (09:50 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 13 Dec 2001 17:50:02 +0000 (09:50 -0800)
        * emit-rtl.c (adjust_address_1): Don't adjust address if adjust
        is false.

From-SVN: r47978

gcc/ChangeLog
gcc/emit-rtl.c

index 664087a4549c590428f250d69dbbd54ef2f10e98..ab1f2601a71e200ae92040ae09ec34a692989f45 100644 (file)
@@ -1,3 +1,8 @@
+2001-12-13  Richard Henderson  <rth@redhat.com>
+
+       * emit-rtl.c (adjust_address_1): Don't adjust address if adjust
+       is false.
+
 2001-12-13  Richard Earnshaw  <rearnsha@arm.com>
 
        * collect2.c (COLLECT_SHARED_INIT_FUNC)
index 72886d16a7983a7c213fb5387d578d61592a9d7f..64a2624412dc83c8d4089b299fac3312b4483571 100644 (file)
@@ -1967,20 +1967,23 @@ adjust_address_1 (memref, mode, offset, validate, adjust)
   unsigned int memalign = MEM_ALIGN (memref);
 
   /* ??? Prefer to create garbage instead of creating shared rtl.
-     This may happen even if adjust is non-zero -- consider
+     This may happen even if offset is non-zero -- consider
      (plus (plus reg reg) const_int) -- so do this always.  */
   addr = copy_rtx (addr);
 
-  /* If MEMREF is a LO_SUM and the offset is within the alignment of the
-     object, we can merge it into the LO_SUM.  */
-  if (GET_MODE (memref) != BLKmode && GET_CODE (addr) == LO_SUM
-      && offset >= 0
-      && (unsigned HOST_WIDE_INT) offset
-         < GET_MODE_ALIGNMENT (GET_MODE (memref)) / BITS_PER_UNIT)
-    addr = gen_rtx_LO_SUM (Pmode, XEXP (addr, 0),
-                          plus_constant (XEXP (addr, 1), offset));
-  else
-    addr = plus_constant (addr, offset);
+  if (adjust)
+    {
+      /* If MEMREF is a LO_SUM and the offset is within the alignment of the
+        object, we can merge it into the LO_SUM.  */
+      if (GET_MODE (memref) != BLKmode && GET_CODE (addr) == LO_SUM
+         && offset >= 0
+         && (unsigned HOST_WIDE_INT) offset
+             < GET_MODE_ALIGNMENT (GET_MODE (memref)) / BITS_PER_UNIT)
+       addr = gen_rtx_LO_SUM (Pmode, XEXP (addr, 0),
+                              plus_constant (XEXP (addr, 1), offset));
+      else
+       addr = plus_constant (addr, offset);
+    }
 
   new = change_address_1 (memref, mode, addr, validate);