This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch ping (Re: [PATCH] Small regrename improvement)


On Thu, Jan 04, 2018 at 10:31:16PM +0100, Jakub Jelinek wrote:
> While debugging PR target/83554, I first thought the bug is that
> regrename creates a new raw REG each time and when the insn uses
> match_dup that it would be a problem.
> 
> While that is not the case, for match_dup we actually check it with
> rtx_equal_p, the patch I wrote can be IMHO still useful to cheaply
> decrease compile time memory a little bit, the original registers are
> often pointer equal and seems they can be replaced by the same new
> REG too.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> 2018-01-04  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* regrename.c (regrename_do_replace): If replacing the same
> 	reg multiple times, try to reuse last created gen_raw_REG.

I'd like to ping this patch (for some reason it didn't make it into
gcc-patches archive).

> --- gcc/regrename.c.jj	2018-01-04 00:43:15.077702454 +0100
> +++ gcc/regrename.c	2018-01-04 11:19:36.975798717 +0100
> @@ -963,6 +963,7 @@ regrename_do_replace (struct du_head *he
>    struct du_chain *chain;
>    unsigned int base_regno = head->regno;
>    machine_mode mode;
> +  rtx last_reg = NULL_RTX, last_repl = NULL_RTX;
>  
>    for (chain = head->first; chain; chain = chain->next_use)
>      {
> @@ -975,12 +976,16 @@ regrename_do_replace (struct du_head *he
>  			 gen_rtx_UNKNOWN_VAR_LOC (), true);
>        else
>  	{
> -	  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;
> +	  if (*chain->loc != last_reg)
> +	    {
> +	      last_repl = gen_raw_REG (GET_MODE (*chain->loc), reg);
> +	      if (regno >= FIRST_PSEUDO_REGISTER)
> +		ORIGINAL_REGNO (last_repl) = regno;
> +	      REG_ATTRS (last_repl) = attr;
> +	      REG_POINTER (last_repl) = reg_ptr;
> +	      last_reg = *chain->loc;
> +	    }
> +	  validate_change (chain->insn, chain->loc, last_repl, true);
>  	}
>      }
>  
> 

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]