diff options
author | Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> | 2017-11-28 18:52:49 +0000 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2017-11-28 19:52:49 +0100 |
commit | e5cf5e116da6f5c018ecc8f714935877c4636780 (patch) | |
tree | 388b7b37472dc993932261974e447d795dcdf3c9 /gcc/tree.c | |
parent | 5e4a80e8a80584741b1e5dd73b936b15862e9171 (diff) | |
download | gcc-e5cf5e116da6f5c018ecc8f714935877c4636780.zip gcc-e5cf5e116da6f5c018ecc8f714935877c4636780.tar.gz gcc-e5cf5e116da6f5c018ecc8f714935877c4636780.tar.bz2 |
[PR 82808] Use proper result types for arithmetic jump functions
2017-11-28 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Martin Jambor <mjambor@suse.cz>
PR ipa/82808
* tree.h (expr_type_first_operand_type_p): Declare
* tree.c (expr_type_first_operand_type_p): New function.
* ipa-prop.h (ipa_get_type): Allow i to be out of bounds.
(ipa_value_from_jfunc): Adjust declaration.
* ipa-cp.c (ipa_get_jf_pass_through_result): New parameter RES_TYPE.
Use it as result type for arithmetics, unless it is NULL in which case
be more conservative.
(ipa_value_from_jfunc): New parameter PARM_TYPE, pass it to
ipa_get_jf_pass_through_result.
(propagate_vals_across_pass_through): Likewise.
(propagate_scalar_across_jump_function): New parameter PARM_TYPE, pass
is to propagate_vals_across_pass_through.
(propagate_constants_across_call): Pass PARM_TYPE to
propagate_scalar_across_jump_function.
(find_more_scalar_values_for_callers_subset): Pass parameter type to
ipa_value_from_jfunc.
(cgraph_edge_brings_all_scalars_for_node): Likewise.
* ipa-fnsummary.c (evaluate_properties_for_edge): Renamed parms_info
to caller_parms_info, pass parameter type to ipa_value_from_jfunc.
* ipa-prop.c (try_make_edge_direct_simple_call): New parameter
target_type, pass it to ipa_value_from_jfunc.
(update_indirect_edges_after_inlining): Pass parameter type to
try_make_edge_direct_simple_call.
testsuite/
* gcc.dg/ipa/pr82808.c: New test.
Co-Authored-By: Martin Jambor <mjambor@suse.cz>
From-SVN: r255212
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -13898,6 +13898,50 @@ arg_size_in_bytes (const_tree type) return TYPE_EMPTY_P (type) ? size_zero_node : size_in_bytes (type); } +/* Return true if an expression with CODE has to have the same result type as + its first operand. */ + +bool +expr_type_first_operand_type_p (tree_code code) +{ + switch (code) + { + case NEGATE_EXPR: + case ABS_EXPR: + case BIT_NOT_EXPR: + case PAREN_EXPR: + case CONJ_EXPR: + + case PLUS_EXPR: + case MINUS_EXPR: + case MULT_EXPR: + case TRUNC_DIV_EXPR: + case CEIL_DIV_EXPR: + case FLOOR_DIV_EXPR: + case ROUND_DIV_EXPR: + case TRUNC_MOD_EXPR: + case CEIL_MOD_EXPR: + case FLOOR_MOD_EXPR: + case ROUND_MOD_EXPR: + case RDIV_EXPR: + case EXACT_DIV_EXPR: + case MIN_EXPR: + case MAX_EXPR: + case BIT_IOR_EXPR: + case BIT_XOR_EXPR: + case BIT_AND_EXPR: + + case LSHIFT_EXPR: + case RSHIFT_EXPR: + case LROTATE_EXPR: + case RROTATE_EXPR: + return true; + + default: + return false; + } +} + /* List of pointer types used to declare builtins before we have seen their real declaration. |