Hi,

I'd like to gentle ping this:

https://gcc.gnu.org/pipermail/gcc-patches/2020-December/562015.html


BR,
Kewen

on 2020/12/16 下午4:49, Kewen.Lin via Gcc-patches wrote:
> Hi,
> 
> When I was investigating unsigned int vec_init issue on Power,
> I happened to find there seems something we can enhance in how
> combine pass invalidate last_set (set last_set_invalid nonzero).
> 
> Currently we have the check:
> 
>       if (!insn
>         || (value && rsp->last_set_table_tick >= label_tick_ebb_start))
>       rsp->last_set_invalid = 1; 
> 
> which means if we want to record some value for some reg and
> this reg got refered before in a valid scope, we invalidate the
> set of reg (last_set_invalid to 1).  It avoids to find the wrong
> set for one reg reference, such as the case like:
> 
>    ... op regX  // this regX could find wrong last_set below
>    regX = ...   // if we think this set is valid
>    ... op regX
> 
> But because of retry's existence, the last_set_table_tick could
> be set by some later reference insns, but we see it's set due
> to retry on the set (for that reg) insn again, such as:
> 
>    insn 1
>    insn 2
> 
>    regX = ...     --> (a)
>    ... op regX    --> (b)
>    
>    insn 3
> 
>    // assume all in the same BB.
> 
> Assuming we combine 1, 2 -> 3 sucessfully and replace them as two
> (3 insns -> 2 insns), retrying from insn1 or insn2 again:
> it will scan insn (a) again, the below condition holds for regX:
> 
>   (value && rsp->last_set_table_tick >= label_tick_ebb_start)
> 
> it will mark this set as invalid set.  But actually the
> last_set_table_tick here is set by insn (b) before retrying, so it
> should be safe to be taken as valid set.
> 
> This proposal is to check whether the last_set_table safely happens
> after the current set, make the set still valid if so.
> 
> Bootstrapped/regtested on powerpc64le-linux-gnu (P9),
> aarch64-linux-gnu and x86_64-pc-linux-gnu.
> 
> Full SPEC2017 building shows this patch gets more sucessful combines
> from 1902208 to 1902243 (trivial though).
> 
> Any comments are highly appreciated!
> 
> BR,
> Kewen
> -----
> 
> gcc/ChangeLog:
> 
>       * combine.c (struct reg_stat_type): New member
>       last_set_table_luid.
>       (update_table_tick): Add one argument for insn luid and
>       set last_set_table_luid with it.
>       (record_value_for_reg): Adjust the condition to set
>       last_set_invalid nonzero.
> 


BR,
Kewen

Reply via email to