===================================================================
@@ -2175,15 +2175,20 @@ offset_address (rtx memref, rtx offset, unsigned H
/* At this point we don't know _why_ the address is invalid. It
could have secondary memory references, multiplies or anything.
+ Yet we can try to force addr into register, in order to catch
+ the scaled addressing opportunity as "reg + scaled_offset".
- However, if we did go and rearrange things, we can wind up not
+ Otherwise, if we did go and rearrange things, we can wind up not
being able to recognize the magic around pic_offset_table_rtx.
This stuff is fragile, and is yet another example of why it is
- bad to expose PIC machinery too early. */
+ bad to expose PIC machinery too early. We may also wind up not
+ being able to recognize the scaled addressing pattern.
+
+ It won't hurt because the address here is invalid and we are
+ going to pre-compute it anyway. */
if (! memory_address_addr_space_p (GET_MODE (memref), new_rtx,
attrs.addrspace)
- && GET_CODE (addr) == PLUS
- && XEXP (addr, 0) == pic_offset_table_rtx)
+ && GET_CODE (addr) == PLUS)
{
addr = force_reg (GET_MODE (addr), addr);
new_rtx = simplify_gen_binary (PLUS, address_mode, addr, offset);