This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Problem with reg_equiv_alt_mem
>On 3/12/07, Unruh, Erwin <Erwin.Unruh@fujitsu-siemens.com> wrote:
>> In a private port I had the problem that reg_equiv_alt_mem_list did
>> contain the same RTL as reg_equiv_memory_loc. This caused an assert
in
>> delete_output_reload, where these are compared with equal_rtx_p.
>> The list is build with push_reg_equiv_alt_mem, but only when "tem !=
>> orig". The value tem is build with find_reloads_address. Within that
>> function we have some code which simply unshares the RTL. The return
>> value will be the new RTL, even in some cases where the RTL did not
>> change.
>>
>> I think the test in front of push_reg_equiv_alt_mem should be done
via
>> rtx_equal_p. This would match the assert in delete_output_reload.
>>
>> My private port is based on GCC 4.1.0, but the code looks the same in
>> 4.3.
>>
>> I do not have papers on file so someone else should prepare a patch.
>
>For sufficiently small patches (usually less than 10 lines changed is
>used as the norm) you don't need to have a copyright assignment on
file.
>Such small changes are apparently not covered by copyright.
>
>So if you could send a patch, that'd be quite helpful ;-)
Well, here is the patch, but ...
- it is based on my (modified) version of GCC 4.1.0
- it is only tested with my private port
- the test is not with the GCC testsuite
I have only limited time and currently no machine where I can bootstrap
full GCC. It misses GMP and MPFR to bootstrap more than C.
So someone else should apply the patch to 4.3 and test it.
Erwin
--- reload.c-old Mon Mar 12 15:45:37 2007
+++ reload.c Mon Mar 12 15:47:53 2007
@@ -4576,7 +4576,7 @@ find_reloads_toplev (rtx x, int opnum, e
x = mem;
i = find_reloads_address (GET_MODE (x), &x, XEXP (x, 0),
&XEXP (x,
0),
opnum, type, ind_levels, insn);
- if (x != mem)
+ if (!rtx_equal_p (x, mem))
push_reg_equiv_alt_mem (regno, x);
if (address_reloaded)
*address_reloaded = i;
@@ -4789,7 +4789,7 @@ find_reloads_address (enum machine_mode
find_reloads_address (GET_MODE (tem), &tem, XEXP (tem,
0),
&XEXP (tem, 0), opnum,
ADDR_TYPE (type), ind_levels,
insn);
- if (tem != orig)
+ if (!rtx_equal_p (tem, orig))
push_reg_equiv_alt_mem (regno, tem);
}
/* We can avoid a reload if the register's equivalent
memory
@@ -5554,7 +5554,7 @@ find_reloads_address_1 (enum machine_mod
RELOAD_OTHER,
ind_levels, insn);
- if (tem != orig)
+ if (!rtx_equal_p (tem, orig))
push_reg_equiv_alt_mem (regno, tem);
/* Then reload the memory location into a base
@@ -5620,7 +5620,7 @@ find_reloads_address_1 (enum machine_mod
find_reloads_address (GET_MODE (tem), &tem, XEXP (tem,
0),
&XEXP (tem, 0), opnum, type,
ind_levels, insn);
- if (tem != orig)
+ if (!rtx_equal_p (tem, orig))
push_reg_equiv_alt_mem (regno, tem);
/* Put this inside a new increment-expression. */
x = gen_rtx_fmt_e (GET_CODE (x), GET_MODE (x), tem);
@@ -5811,7 +5811,7 @@ find_reloads_address_1 (enum machine_mod
find_reloads_address (GET_MODE (x), &x, XEXP (x, 0),
&XEXP (x, 0), opnum, ADDR_TYPE
(type),
ind_levels, insn);
- if (x != tem)
+ if (!rtx_equal_p (x, tem))
push_reg_equiv_alt_mem (regno, x);
}
}
@@ -6033,7 +6033,7 @@ find_reloads_subreg_address (rtx x, int
&XEXP (tem, 0), opnum, type,
ind_levels, insn);
/* ??? Do we need to handle nonzero offsets somehow? */
- if (!offset && tem != orig)
+ if (!offset && !rtx_equal_p (tem, orig))
push_reg_equiv_alt_mem (regno, tem);
/* If this is not a toplevel operand, find_reloads doesn't
see