purge_addressof bootstrap failure (was fix opt/8634)
Andreas Tobler
toa@pop.agri.ch
Sun Apr 13 13:39:00 GMT 2003
Hi,
is the fix below ready to go in ? Or are there some other problems with?
As reported, the fix below makes the two tc's pass on darwin and linux-ppc.
Thanks,
Andreas
Zdenek Dvorak wrote:
>>These two ?
>>
>>FAIL: gcc.c-torture/compile/990107-1.c, -O1
>>FAIL: gcc.c-torture/compile/990203-1.c, -O1
> here's the fix.
>
> Zdenek
>
> * function.c (purge_addressof): Re-process notes after postponed
> insns processing.
>
> Index: function.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/function.c,v
> retrieving revision 1.415
> diff -c -3 -p -r1.415 function.c
> *** function.c 9 Apr 2003 06:32:21 -0000 1.415
> --- function.c 10 Apr 2003 11:59:29 -0000
> *************** purge_addressof (insns)
> *** 3407,3412 ****
> --- 3407,3413 ----
> {
> rtx insn, tmp;
> htab_t ht;
> + rtx postponed_notes = NULL_RTX;
>
> /* When we actually purge ADDRESSOFs, we turn REGs into MEMs. That
> requires a fixup pass over the instruction stream to correct
> *************** purge_addressof (insns)
> *** 3431,3451 ****
>
> if (! purge_addressof_1 (®_NOTES (insn), NULL_RTX, 0, 0, 0, ht))
> {
> ! /* If we could not replace the ADDRESSOFs in the insn's notes,
> ! we can just remove the offending notes instead. */
> ! rtx note;
> !
> ! for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
> ! {
> ! /* If we find a REG_RETVAL note then the insn is a libcall.
> ! Such insns must have REG_EQUAL notes as well, in order
> ! for later passes of the compiler to work. So it is not
> ! safe to delete the notes here, and instead we abort. */
> ! if (REG_NOTE_KIND (note) == REG_RETVAL)
> ! abort ();
> ! if (for_each_rtx (¬e, is_addressof, NULL))
> ! remove_note (insn, note);
> ! }
> }
> }
>
> --- 3432,3440 ----
>
> if (! purge_addressof_1 (®_NOTES (insn), NULL_RTX, 0, 0, 0, ht))
> {
> ! /* The failure may be due to postponed insns; so let's try this
> ! again after the postponed insns are processed. */
> ! postponed_notes = alloc_INSN_LIST (insn, postponed_notes);
> }
> }
>
> *************** purge_addressof (insns)
> *** 3460,3465 ****
> --- 3449,3482 ----
> if (! purge_addressof_1 (&PATTERN (insn), insn,
> asm_noperands (PATTERN (insn)) > 0, 0, 0, ht))
> abort ();
> + }
> +
> + /* And postponed notes. */
> + while (postponed_notes)
> + {
> + insn = XEXP (postponed_notes, 0);
> + tmp = postponed_notes;
> + postponed_notes = XEXP (postponed_notes, 1);
> + free_INSN_LIST_node (tmp);
> +
> + if (! purge_addressof_1 (®_NOTES (insn), NULL_RTX, 0, 0, 0, ht))
> + {
> + /* If we could not replace the ADDRESSOFs in the insn's notes,
> + we can just remove the offending notes instead. */
> + rtx note;
> +
> + for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
> + {
> + /* If we find a REG_RETVAL note then the insn is a libcall.
> + Such insns must have REG_EQUAL notes as well, in order
> + for later passes of the compiler to work. So it is not
> + safe to delete the notes here, and instead we abort. */
> + if (REG_NOTE_KIND (note) == REG_RETVAL)
> + abort ();
> + if (for_each_rtx (¬e, is_addressof, NULL))
> + remove_note (insn, note);
> + }
> + }
> }
>
> /* Clean up. */
>
More information about the Gcc-patches
mailing list