diff options
author | Martin Jambor <mjambor@suse.cz> | 2013-05-13 12:16:09 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2013-05-13 12:16:09 +0200 |
commit | 4502fe8dfcb1cc2c59b50b868ac75fb5cdd742fc (patch) | |
tree | eb36587215072023d7faafc93b4cb03eb6f629f3 /gcc/ipa-prop.h | |
parent | 0864bfc257a3d3198ba182c562b729ba1e96466d (diff) | |
download | gcc-4502fe8dfcb1cc2c59b50b868ac75fb5cdd742fc.zip gcc-4502fe8dfcb1cc2c59b50b868ac75fb5cdd742fc.tar.gz gcc-4502fe8dfcb1cc2c59b50b868ac75fb5cdd742fc.tar.bz2 |
re PR middle-end/42371 (dead code not eliminated during folding with whole-program)
2013-05-13 Martin Jambor <mjambor@suse.cz>
PR middle-end/42371
* ipa-prop.h (IPA_UNDESCRIBED_USE): New macro.
(ipa_constant_data): New type.
(ipa_jump_func): Use ipa_constant_data to hold information about
constant jump functions.
(ipa_get_jf_constant): Adjust to jump function type changes.
(ipa_get_jf_constant_rdesc): New function.
(ipa_param_descriptor): New field controlled_uses.
(ipa_get_controlled_uses): New function.
(ipa_set_controlled_uses): Likewise.
* ipa-ref.h (ipa_find_reference): Declare.
* ipa-prop.c (ipa_cst_ref_desc): New type.
(ipa_print_node_jump_functions_for_edge): Adjust for jump function type
changes.
(ipa_set_jf_constant): Likewise. Also create reference descriptions.
New parameter cs. Adjust all callers.
(ipa_analyze_params_uses): Detect uncontrolled and controlled uses.
(remove_described_reference): New function.
(jfunc_rdesc_usable): Likewise.
(try_make_edge_direct_simple_call): Decrement controlled use count,
attempt to remove reference if it hits zero.
(combine_controlled_uses_counters): New function.
(propagate_controlled_uses): Likewise.
(ipa_propagate_indirect_call_infos): Call propagate_controlled_uses.
(ipa_edge_duplication_hook): Duplicate reference descriptions.
(ipa_print_node_params): Print described use counter.
(ipa_write_jump_function): Adjust to jump function type changes.
(ipa_read_jump_function): New parameter CS, pass it to
ipa_set_jf_constant. Adjust caller.
(ipa_write_node_info): Stream controlled use count
(ipa_read_node_info): Likewise.
* cgraph.c (cgraph_mark_address_taken_node): Bail out instead of
asserting.
* ipa-cp.c (ipcp_discover_new_direct_edges): Decrement controlled use
count. Remove cloning-added reference if it reaches zero.
* ipa-ref.c (ipa_find_reference): New function.
testsuite/
* gcc.dg/ipa/remref-0.c: New test.
* gcc.dg/ipa/remref-1a.c: Likewise.
* gcc.dg/ipa/remref-1b.c: Likewise.
* gcc.dg/ipa/remref-2a.c: Likewise.
* gcc.dg/ipa/remref-2b.c: Likewise.
From-SVN: r198821
Diffstat (limited to 'gcc/ipa-prop.h')
-rw-r--r-- | gcc/ipa-prop.h | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index e75826f..3399e82 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -29,6 +29,8 @@ along with GCC; see the file COPYING3. If not see /* The following definitions and interfaces are used by interprocedural analyses or parameters. */ +#define IPA_UNDESCRIBED_USE -1 + /* ipa-prop.c stuff (ipa-cp, indirect inlining): */ /* A jump function for a callsite represents the values passed as actual @@ -84,6 +86,17 @@ struct GTY(()) ipa_known_type_data tree component_type; }; +struct ipa_cst_ref_desc; + +/* Structure holding data required to describe a constant jump function. */ +struct GTY(()) ipa_constant_data +{ + /* THe value of the constant. */ + tree value; + /* Pointer to the structure that describes the reference. */ + struct ipa_cst_ref_desc GTY((skip)) *rdesc; +}; + /* Structure holding data required to describe a pass-through jump function. */ struct GTY(()) ipa_pass_through_data @@ -172,7 +185,7 @@ typedef struct GTY (()) ipa_jump_func union jump_func_value { struct ipa_known_type_data GTY ((tag ("IPA_JF_KNOWN_TYPE"))) known_type; - tree GTY ((tag ("IPA_JF_CONST"))) constant; + struct ipa_constant_data GTY ((tag ("IPA_JF_CONST"))) constant; struct ipa_pass_through_data GTY ((tag ("IPA_JF_PASS_THROUGH"))) pass_through; struct ipa_ancestor_jf_data GTY ((tag ("IPA_JF_ANCESTOR"))) ancestor; } GTY ((desc ("%1.type"))) value; @@ -213,7 +226,14 @@ static inline tree ipa_get_jf_constant (struct ipa_jump_func *jfunc) { gcc_checking_assert (jfunc->type == IPA_JF_CONST); - return jfunc->value.constant; + return jfunc->value.constant.value; +} + +static inline struct ipa_cst_ref_desc * +ipa_get_jf_constant_rdesc (struct ipa_jump_func *jfunc) +{ + gcc_checking_assert (jfunc->type == IPA_JF_CONST); + return jfunc->value.constant.rdesc; } /* Return the operand of a pass through jmp function JFUNC. */ @@ -296,6 +316,10 @@ struct ipa_param_descriptor { /* PARAM_DECL of this parameter. */ tree decl; + /* If all uses of the parameter are described by ipa-prop structures, this + says how many there are. If any use could not be described by means of + ipa-prop structures, this is IPA_UNDESCRIBED_USE. */ + int controlled_uses; /* The parameter is used. */ unsigned used : 1; }; @@ -365,6 +389,23 @@ ipa_set_param_used (struct ipa_node_params *info, int i, bool val) info->descriptors[i].used = val; } +/* Return how many uses described by ipa-prop a parameter has or + IPA_UNDESCRIBED_USE if there is a use that is not described by these + structures. */ +static inline int +ipa_get_controlled_uses (struct ipa_node_params *info, int i) +{ + return info->descriptors[i].controlled_uses; +} + +/* Set the controlled counter of a given parameter. */ + +static inline void +ipa_set_controlled_uses (struct ipa_node_params *info, int i, int val) +{ + info->descriptors[i].controlled_uses = val; +} + /* Return the used flag corresponding to the Ith formal parameter of the function associated with INFO. */ |