Patchwork [8/8] Only merge deps status for true dependencies

login
register
mail settings
Submitter Alexander Monakov
Date Aug. 3, 2011, 3:30 p.m.
Message ID <1312385438-6273-9-git-send-email-amonakov@ispras.ru>
Download mbox | patch
Permalink /patch/108283/
State New
Headers show

Comments

Alexander Monakov - Aug. 3, 2011, 3:30 p.m.
From: Sergey Grechanik <mouseentity@condor.intra.ispras.ru>

This patch avoids changing speculative bits of a register use when it is moved
up above a speculation check where that register is used as the address
register.  We should only call ds_full_merge when the producer (speculation
check) writes to a register.

(A similar check was in place when selective scheduler was in active
development, but was dropped before it was merged, probably by accident)

2011-08-04  Sergey Grechanik  <mouseentity@ispras.ru>

	* sel-sched-ir.c (has_dependence_note_reg_use): Call ds_full_merge
	only if producer writes to the register given by regno.
Vladimir Makarov - Aug. 10, 2011, 8:16 p.m.
On 08/03/2011 11:30 AM, Alexander Monakov wrote:
> From: Sergey Grechanik<mouseentity@condor.intra.ispras.ru>
>
> This patch avoids changing speculative bits of a register use when it is moved
> up above a speculation check where that register is used as the address
> register.  We should only call ds_full_merge when the producer (speculation
> check) writes to a register.
>
> (A similar check was in place when selective scheduler was in active
> development, but was dropped before it was merged, probably by accident)
>
> 2011-08-04  Sergey Grechanik<mouseentity@ispras.ru>
>
> 	* sel-sched-ir.c (has_dependence_note_reg_use): Call ds_full_merge
> 	only if producer writes to the register given by regno.
>
> diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
> index 91f9dd9..745fcc1 100644
> --- a/gcc/sel-sched-ir.c
> +++ b/gcc/sel-sched-ir.c
> @@ -3227,7 +3227,10 @@ has_dependence_note_reg_use (int regno)
>   	  pro_spec_checked_ds = INSN_SPEC_CHECKED_DS (has_dependence_data.pro);
>   	  pro_spec_checked_ds = ds_get_max_dep_weak (pro_spec_checked_ds);
>
> -	  if (pro_spec_checked_ds != 0)
> +	  if (pro_spec_checked_ds != 0
> +	      /* FIXME: if mode for REGNO was available here, we could use
> +	         register_unavailable_p that tests all hard regs for mode.  */
I don't think you need the mode here.  For pseudo register it is always 
1. For hard registers note_reg_use is always called for every hard 
register containing a value.

So the patch is ok, if you remove the comment or write what I mentioned 
as the comment.

Thanks.
> +	&&  bitmap_bit_p (INSN_REG_SETS (has_dependence_data.pro), regno))
>   	    /* Merge BE_IN_SPEC bits into *DSP.  */
>   	    *dsp = ds_full_merge (*dsp, pro_spec_checked_ds,
>   				  NULL_RTX, NULL_RTX);

Patch

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 91f9dd9..745fcc1 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -3227,7 +3227,10 @@  has_dependence_note_reg_use (int regno)
 	  pro_spec_checked_ds = INSN_SPEC_CHECKED_DS (has_dependence_data.pro);
 	  pro_spec_checked_ds = ds_get_max_dep_weak (pro_spec_checked_ds);
 
-	  if (pro_spec_checked_ds != 0)
+	  if (pro_spec_checked_ds != 0
+	      /* FIXME: if mode for REGNO was available here, we could use
+	         register_unavailable_p that tests all hard regs for mode.  */
+	      && bitmap_bit_p (INSN_REG_SETS (has_dependence_data.pro), regno))
 	    /* Merge BE_IN_SPEC bits into *DSP.  */
 	    *dsp = ds_full_merge (*dsp, pro_spec_checked_ds,
 				  NULL_RTX, NULL_RTX);