This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: sysv/ms_abi attribute fix, part 3, ICE in IRA
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Jan Hubicka" <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, iant at google dot com, zadeck at naturalbridge dot com
- Date: Mon, 29 Dec 2008 16:59:44 +0100
- Subject: Re: sysv/ms_abi attribute fix, part 3, ICE in IRA
- References: <20081214113437.GF25593@kam.mff.cuni.cz>
On Sun, Dec 14, 2008 at 12:34 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
>
> Hi,
> ira-cost is not doing lazy initialization of move_cost. This is probably
> OK in most cases because someone else initializes it anyway, but with ABI changes
> we throw it away often and get NULL pointer dereferences.
>
> Bootstrapped/regtested i686-linux, OK?
Ok.
Thanks,
Richard.
> Jan Hubicka <jh@suse.cz>
> Kai Tietz <kai.tietz@onevision.com>
> * ira-cost.c (copy_cost): Lazilly initialize move_cost if needed.
> Index: ira-costs.c
> ===================================================================
> *** ira-costs.c (revision 142597)
> --- ira-costs.c (working copy)
> *************** copy_cost (rtx x, enum machine_mode mode
> *** 139,146 ****
> ira_init_register_move_cost (mode);
>
> if (secondary_class != NO_REGS)
> ! return (move_cost[mode][secondary_class][rclass] + sri.extra_cost
> ! + copy_cost (x, mode, secondary_class, to_p, &sri));
>
> /* For memory, use the memory move cost, for (hard) registers, use
> the cost to move between the register classes, and use 2 for
> --- 139,150 ----
> ira_init_register_move_cost (mode);
>
> if (secondary_class != NO_REGS)
> ! {
> ! if (!move_cost[mode])
> ! init_move_cost (mode);
> ! return (move_cost[mode][secondary_class][rclass] + sri.extra_cost
> ! + copy_cost (x, mode, secondary_class, to_p, &sri));
> ! }
>
> /* For memory, use the memory move cost, for (hard) registers, use
> the cost to move between the register classes, and use 2 for
> *************** copy_cost (rtx x, enum machine_mode mode
> *** 148,155 ****
> if (MEM_P (x) || rclass == NO_REGS)
> return sri.extra_cost + ira_memory_move_cost[mode][rclass][to_p != 0];
> else if (REG_P (x))
> ! return
> ! (sri.extra_cost + move_cost[mode][REGNO_REG_CLASS (REGNO (x))][rclass]);
> else
> /* If this is a constant, we may eventually want to call rtx_cost
> here. */
> --- 152,162 ----
> if (MEM_P (x) || rclass == NO_REGS)
> return sri.extra_cost + ira_memory_move_cost[mode][rclass][to_p != 0];
> else if (REG_P (x))
> ! {
> ! if (!move_cost[mode])
> ! init_move_cost (mode);
> ! return (sri.extra_cost + move_cost[mode][REGNO_REG_CLASS (REGNO (x))][rclass]);
> ! }
> else
> /* If this is a constant, we may eventually want to call rtx_cost
> here. */
>