[RFC] Handle unary pass-through jump functions for ipa-vrp

Jan Hubicka hubicka@ucw.cz
Thu Oct 27 14:59:00 GMT 2016


> gcc/testsuite/ChangeLog:
> 
> 2016-10-25  Kugan Vivekanandarajah  <kuganv@linaro.org>
> 
> 	* gcc.dg/ipa/vrp7.c: New test.
> 
> 
> gcc/ChangeLog:
> 
> 2016-10-25  Kugan Vivekanandarajah  <kuganv@linaro.org>
> 
> 	* ipa-cp.c (ipa_get_jf_pass_through_result): Skip unary expressions.
> 	(propagate_vr_accross_jump_function): Handle unary expressions.
> 	(propagate_constants_accross_call): Pass param type to
> 	propagate_vr_accross_jump_function.
> 	* ipa-prop.c (load_from_param): Renamed from load_from_unmodified_param.
> 	Also handles unary expr.
> 	(ipa_set_jf_unary_pass_through): New.
> 	(ipa_load_from_parm_agg): Renamed load_from_unmodified_param.
> 	(compute_complex_assign_jump_func): Handle unary expressions.
> 	(ipa_write_jump_function): Likewise.
> 	(ipa_read_jump_function): Likewise.
> 	* ipa-prop.h: export ipa_get_callee_param_type.

> diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
> index 1dc5cb6..d0dc3d7 100644
> --- a/gcc/ipa-cp.c
> +++ b/gcc/ipa-cp.c
> @@ -122,6 +122,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "ipa-inline.h"
>  #include "ipa-utils.h"
>  #include "tree-ssa-ccp.h"
> +#include "gimple.h"
>  
>  template <typename valtype> class ipcp_value;
>  
> @@ -1221,7 +1222,12 @@ ipa_get_jf_pass_through_result (struct ipa_jump_func *jfunc, tree input)
>  
>    if (ipa_get_jf_pass_through_operation (jfunc) == NOP_EXPR)
>      return input;
> -  if (!is_gimple_ip_invariant (input))
> +
> +  if (!is_gimple_ip_invariant (input)
> +      /* TODO: Unary expressions are not handles in ipa constant
> +	 propagation. */

handled.
I would expect them to be already folded here?  I would expect that hanlding
unary expressions in constant propagation is no harder than for VRP?

> +     || (TREE_CODE_CLASS (ipa_get_jf_pass_through_operation (jfunc))
> +	  == tcc_unary))
>      return NULL_TREE;
>  
>    if (TREE_CODE_CLASS (ipa_get_jf_pass_through_operation (jfunc))
> @@ -1845,7 +1851,8 @@ propagate_bits_accross_jump_function (cgraph_edge *cs, int idx, ipa_jump_func *j
>  static bool
>  propagate_vr_accross_jump_function (cgraph_edge *cs,
>  				    ipa_jump_func *jfunc,
> -				    struct ipcp_param_lattices *dest_plats)
> +				    struct ipcp_param_lattices *dest_plats,
> +				    tree param_type)

New param needs comment.

Patch is OK with changes Martin suggested.

Honza



More information about the Gcc-patches mailing list