diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2019-12-18 14:21:51 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2019-12-18 13:21:51 +0000 |
commit | c7ac9a0c7e3916f192ad41227e16238fd1fa2fbf (patch) | |
tree | e68d5f0c5a6cebf9e7164a3aff5b36fbb475d67b /gcc/ipa-prop.c | |
parent | 1ad431f95c200fe4d1eccab9cd5487087adc2bd8 (diff) | |
download | gcc-c7ac9a0c7e3916f192ad41227e16238fd1fa2fbf.zip gcc-c7ac9a0c7e3916f192ad41227e16238fd1fa2fbf.tar.gz gcc-c7ac9a0c7e3916f192ad41227e16238fd1fa2fbf.tar.bz2 |
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 <mjambor@suse.cz>
From-SVN: r279523
Diffstat (limited to 'gcc/ipa-prop.c')
-rw-r--r-- | gcc/ipa-prop.c | 37 |
1 files changed, 37 insertions, 0 deletions
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<ipa_bits *, va_gc> &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. */ |