[RFA:] Fix PR target/{18329,18330}, incorrect deletion of an output reload, take 2.
Hans-Peter Nilsson
hp@bitrange.com
Wed Jan 12 11:46:00 GMT 2005
See discussion at <URL:http://gcc.gnu.org/ml/gcc-patches/2005-01/msg00478.html>.
As per RTH's request, I now prune the output-reload-killing if
the lifetime of the pseudo is more than one basic block. That
means that the first test (for labels and jumps) is redundant,
so I removed it to avoid confusion. As noted in the comment,
this patch doesn't handle non-call-exceptions. Doing that
should be a separate patch; it was just noted on inspection.
(I don't know how to create such a a test-case; such a test
would be very target-specific and the MMIX port and simulator,
as most other target-only ports, doesn't support
non-call-exceptions.)
Built and tested native i686-pc-linux-gnu (FC2) and cross to
mmix-knuth-mmixware, no regressions.
Ok to commit?
PR target/18329
PR target/18330
* reload1.c (delete_output_reload): Don't delete an output reload
if the pseudo lives longer than a single basic block. Adjust and
improve wording of comment and add FIXME for non-call-exceptions.
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.458
diff -p -c -r1.458 reload1.c
*** reload1.c 6 Jan 2005 04:09:34 -0000 1.458
--- reload1.c 11 Jan 2005 19:43:17 -0000
*************** delete_output_reload (rtx insn, int j, i
*** 7624,7637 ****
/* If the pseudo-reg we are reloading is no longer referenced
anywhere between the store into it and here,
! and no jumps or labels intervene, then the value can get
! here through the reload reg alone.
Otherwise, give up--return. */
for (i1 = NEXT_INSN (output_reload_insn);
i1 != insn; i1 = NEXT_INSN (i1))
{
! if (LABEL_P (i1) || JUMP_P (i1))
return;
if ((NONJUMP_INSN_P (i1) || CALL_P (i1))
&& reg_mentioned_p (reg, PATTERN (i1)))
{
--- 7624,7638 ----
/* If the pseudo-reg we are reloading is no longer referenced
anywhere between the store into it and here,
! and we're within the same basic block, then the value can only
! pass through the reload reg and end up here.
Otherwise, give up--return. */
for (i1 = NEXT_INSN (output_reload_insn);
i1 != insn; i1 = NEXT_INSN (i1))
{
! if (NOTE_INSN_BASIC_BLOCK_P (i1))
return;
+ /* FIXME: non-call exceptions need to be handled. */
if ((NONJUMP_INSN_P (i1) || CALL_P (i1))
&& reg_mentioned_p (reg, PATTERN (i1)))
{
brgds, H-P
More information about the Gcc-patches
mailing list