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]

Re: [RFC] Extend ipa-bitwise-cp with pointer alignment propagation


> Hi,
> The attached patch tries to extend ipa bits propagation to handle
> pointer alignment propagation.
> The patch just disables ipa-cp-alignment pass, I suppose we want to
> eventually remove it ?

Yes, can you please verify that alignments it computes are monotonously
worse than those your new code computes and include the removal in the
next iteration of the patch?
> 
> Bootstrap+tested on x86_64-unknown-linux-gnu.
> Cross-tested on arm*-*-*, aarch64*-*-*.
> Does the patch look OK ?
> 
> Thanks,
> Prathamesh
> @@ -2258,8 +2271,8 @@ propagate_constants_accross_call (struct cgraph_edge *cs)
>  							 &dest_plats->itself);
>  	  ret |= propagate_context_accross_jump_function (cs, jump_func, i,
>  							  &dest_plats->ctxlat);
> -	  ret |= propagate_alignment_accross_jump_function (cs, jump_func,
> -							 &dest_plats->alignment);
> +//	  ret |= propagate_alignment_accross_jump_function (cs, jump_func,
> +//							 &dest_plats->alignment);

obviously we do not want commented out ocde..

>  	  ret |= propagate_bits_accross_jump_function (cs, i, jump_func,
>  						       &dest_plats->bits_lattice);
>  	  ret |= propagate_aggs_accross_jump_function (cs, jump_func,
> diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
> index 1629781..5cee27b 100644
> --- a/gcc/ipa-prop.c
> +++ b/gcc/ipa-prop.c
> @@ -1701,6 +1701,16 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi,
>  	      jfunc->bits.mask = 0;
>  	    }
>  	}
> +      else if (POINTER_TYPE_P (TREE_TYPE (arg)))
> +	{
> +	  unsigned HOST_WIDE_INT bitpos;
> +	  unsigned align;
> +
> +	  jfunc->bits.known = true;
> +	  get_pointer_alignment_1 (arg, &align, &bitpos);
> +	  jfunc->bits.mask = wi::mask<widest_int>(TYPE_PRECISION (TREE_TYPE (arg)), false).and_not (align / BITS_PER_UNIT - 1);

... and long lines :)

> +	  jfunc->bits.value = bitpos / BITS_PER_UNIT;
> +	}
>        else
>  	gcc_assert (!jfunc->bits.known);
>  
> @@ -5534,7 +5544,7 @@ ipcp_update_bits (struct cgraph_node *node)
>        next_parm = DECL_CHAIN (parm);
>  
>        if (!bits[i].known
> -	  || !INTEGRAL_TYPE_P (TREE_TYPE (parm))
> +	  || !(INTEGRAL_TYPE_P (TREE_TYPE (parm)) || POINTER_TYPE_P (TREE_TYPE (parm)))

I suppose eventually we may want to enable other types, too.
It does even make sense to propagate this on aggregates, but definitly on
vectors and complex numbers.  

Otherwise the patch seems fine to me (modulo Richard's comments)
Honza


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