https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66140

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-05-14
                 CC|                            |rth at gcc dot gnu.org,
                   |                            |ubizjak at gmail dot com
     Ever confirmed|0                           |1

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
Confirmed with a cross from x86_64-linux-gnu.

The problem is with (insn 56), where reload does:

Reloads for insn # 56
Reload 0: reload_in (DI) = (reg/v/f:DI 71 [ bpl ])
        GENERAL_REGS, RELOAD_FOR_OUTPUT_ADDRESS (opnum = 0)
        reload_in_reg: (reg/v/f:DI 71 [ bpl ])
        reload_reg_rtx: (reg:DI 4 $4)
Reload 1: GENERAL_REGS, RELOAD_FOR_OUTPUT_ADDRESS (opnum = 0), can't combine,
secondary_reload_p
        reload_reg_rtx: (reg:TI 2 $2)
Reload 2: reload_out (QI) = (mem:QI (plus:DI (reg/v/f:DI 71 [ bpl ])
                                                        (const_int 3 [0x3])) [1
*bpl_5+3 S1 A8])
        GENERAL_REGS, RELOAD_FOR_OUTPUT (opnum = 0)
        reload_out_reg: (mem:QI (plus:DI (reg/v/f:DI 71 [ bpl ])
                                                        (const_int 3 [0x3])) [1
*bpl_5+3 S1 A8])
        reload_reg_rtx: (reg:QI 5 $5)
        secondary_out_reload = 1

        secondary_out_icode = reload_outqi

Tracing the RTX through reload_outqi, we enter with operands[0]:

(mem:QI (plus:DI (reg/v/f:DI 71 [ bpl ])
        (const_int 3 [0x3])) [1 *bpl_5+3 S1 A8])

and get_unaligned_addr returns:

(plus:DI (reg/v/f:DI 71 [ bpl ])
    (const_int 3 [0x3]))

But ... (reg/v/f:DI 71 [ bpl ]) is scheduled for reload in Reload 0, and got
its replacement register (reg:DI 4 $4).

So, we have to call find_replacement in get_unaligned_address, even if (ref) is
otherwise correct memory_address_p operand.

With the (totaly untested) patch below, get_unaligned_address returns:

(plus:DI (reg:DI 4 $4)
    (const_int 3 [0x3]))

--cut here--
Index: alpha.c
===================================================================
--- alpha.c     (revision 223201)
+++ alpha.c     (working copy)
@@ -1602,8 +1602,7 @@ get_unaligned_address (rtx ref)

   gcc_assert (MEM_P (ref));

-  if (reload_in_progress
-      && ! memory_address_p (GET_MODE (ref), XEXP (ref, 0)))
+  if (reload_in_progress)
     {
       base = find_replacement (&XEXP (ref, 0));

--cut here--

Reply via email to