From c7ac9a0c7e3916f192ad41227e16238fd1fa2fbf Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 18 Dec 2019 14:21:51 +0100 Subject: ipa-param-manipulation.h (get_original_index): Declare. * ipa-param-manipulation.h (get_original_index): Declare. * ipa-param-manipulation.c (ipa_param_adjustments::get_original_index): New member function. * ipa-prop.c (ipcp_get_parm_bits): New function. * ipa-prop.h (ipcp_get_parm_bits): Declare. * tree-ssa-ccp.c: Include cgraph.h, alloc-pool.h, symbol-summary.h, ipa-utils.h and ipa-prop.h (get_default_value): Use ipcp_get_parm_bits. * gcc.dg/ipa/ipa-bit-cp.c: New testcase. * gcc.dg/ipa/ipa-bit-cp-1.c: New testcase. * gcc.dg/ipa/ipa-bit-cp-2.c: New testcase. Co-Authored-By: Martin Jambor From-SVN: r279523 --- gcc/ipa-prop.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'gcc/ipa-prop.c') diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 1a59c35..c9c6a82 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -5480,6 +5480,43 @@ ipcp_modif_dom_walker::before_dom_children (basic_block bb) return NULL; } +/* Return true if we have recorded VALUE and MASK about PARM. + Set VALUE and MASk accordingly. */ + +bool +ipcp_get_parm_bits (tree parm, tree *value, widest_int *mask) +{ + cgraph_node *cnode = cgraph_node::get (current_function_decl); + ipcp_transformation *ts = ipcp_get_transformation_summary (cnode); + if (!ts || vec_safe_length (ts->bits) == 0) + return false; + + int i = 0; + for (tree p = DECL_ARGUMENTS (current_function_decl); + p != parm; p = DECL_CHAIN (p)) + { + i++; + /* Ignore static chain. */ + if (!p) + return false; + } + + if (cnode->clone.param_adjustments) + { + i = cnode->clone.param_adjustments->get_original_index (i); + if (i < 0) + return false; + } + + vec &bits = *ts->bits; + if (!bits[i]) + return false; + *mask = bits[i]->mask; + *value = wide_int_to_tree (TREE_TYPE (parm), bits[i]->value); + return true; +} + + /* Update bits info of formal parameters as described in ipcp_transformation. */ -- cgit v1.1