[patch] fix regrename pass to ensure renamings produce valid insns

Bernd Schmidt bernds_cb1@t-online.de
Fri Nov 6 10:48:00 GMT 2015


On 06/17/2015 07:11 PM, Sandra Loosemore wrote:

> 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;

With a patch I'm working on that uses the renamer more often, I found 
that this is causing compare-debug failures. Validating changes to 
debug_insns (the INSN_VAR_LOCATION_LOC in particular) can apparently fail.

The following fix was bootstrapped and tested with -frename-registers 
enabled at -O1 on x86_64-linux. Ok?


Bernd

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rr-dinsn.diff
Type: text/x-patch
Size: 1313 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20151106/666e604f/attachment.bin>


More information about the Gcc-patches mailing list