This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] fix regrename pass to ensure renamings produce valid insns
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Sandra Loosemore <sandra at codesourcery dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Chung-Lin Tang <cltang at CODESOURCERY dot COM>
- Date: Wed, 17 Jun 2015 19:52:03 +0100
- Subject: Re: [patch] fix regrename pass to ensure renamings produce valid insns
- Authentication-results: sourceware.org; auth=none
- References: <5581AA41 dot 7010201 at codesourcery dot com>
Sandra Loosemore <sandra@codesourcery.com> writes:
> Index: gcc/regrename.c
> ===================================================================
> --- gcc/regrename.c (revision 224532)
> +++ gcc/regrename.c (working copy)
> @@ -942,19 +942,22 @@ regrename_do_replace (struct du_head *he
> int reg_ptr = REG_POINTER (*chain->loc);
>
> if (DEBUG_INSN_P (chain->insn) && REGNO (*chain->loc) != base_regno)
> - INSN_VAR_LOCATION_LOC (chain->insn) = gen_rtx_UNKNOWN_VAR_LOC ();
> + validate_change (chain->insn, &(INSN_VAR_LOCATION_LOC (chain->insn)),
> + gen_rtx_UNKNOWN_VAR_LOC (), true);
> else
> {
> - *chain->loc = gen_raw_REG (GET_MODE (*chain->loc), reg);
> + validate_change (chain->insn, chain->loc,
> + gen_raw_REG (GET_MODE (*chain->loc), reg), true);
> if (regno >= FIRST_PSEUDO_REGISTER)
> ORIGINAL_REGNO (*chain->loc) = regno;
> REG_ATTRS (*chain->loc) = attr;
> REG_POINTER (*chain->loc) = reg_ptr;
> }
I think it'd be cleaner to do the adjustments on the new register before
passing it to validate_change.
LGTM otherwise for what it's worth.
Thanks,
Richard