diff options
author | Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> | 2016-10-09 04:48:50 +0000 |
---|---|---|
committer | Prathamesh Kulkarni <prathamesh3492@gcc.gnu.org> | 2016-10-09 04:48:50 +0000 |
commit | 67b974787c1e77ebebb4f36cdf09ac11a5690f43 (patch) | |
tree | 152594ddc68b650d1a9417e3b3ee8df10731b94a /gcc/ipa-prop.c | |
parent | e525cfa7e30afee5c4c5a4224c5c340ae95cf75f (diff) | |
download | gcc-67b974787c1e77ebebb4f36cdf09ac11a5690f43.zip gcc-67b974787c1e77ebebb4f36cdf09ac11a5690f43.tar.gz gcc-67b974787c1e77ebebb4f36cdf09ac11a5690f43.tar.bz2 |
ipa-cp.c (ipcp_alignment_lattice): Remove.
2016-10-09 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* ipa-cp.c (ipcp_alignment_lattice): Remove.
(ipcp_param_lattices): Remove field alignment.
(print_all_lattices): Remove call to ipcp_alignment_lattice::print.
(set_all_contains_variable): Remove call to
ipcp_alignment_lattice::set_to_bottom.
(initialize_node_lattices): Likewise.
(propagate_alignment_accross_jump_function): Remove.
(propagate_constants_accross_call): Remove call to
propagate_alignment_accross_jump_function.
(ipcp_store_alignment_results): Remove.
(ipcp_driver): Remove call to ipcp_store_alignment_results.
(propagate_bits_accross_jump_function): Handle ancestor jump function.
* ipa-prop.c (ipa_print_node_jump_functions_for_edge): Remove
pretty-printing of alignment jump function.
(ipa_set_jf_unknown): Remove assignment to jfunc->alignment.known.
(ipa_compute_jump_functions_for_edge): Adjust ipa_bits jump function for
alignments and remove computing ipa_alignment jump function.
(ipa_node_params_t::duplicate): Remove copying of src_trans->alignments.
(ipa_write_jump_functions): Remove streaming for ipa_alignment.
(ipa_read_jump_function): Remove reading of ipa_alignment.
(write_ipcp_transformation_info): Remove streaming for alignment
propagation summary.
(read_ipcp_transformation_info): Remove reading of alignment
propagation summary.
(ipcp_update_alignments): Remove.
(ipcp_update_bits): Adjust to set alignment for parameters of pointer
type.
(ipcp_transform_function): Remove call to ipcp_update_alignments()
and remove assignment to (*ipcp_transformations)[node->uid].alignments.
* ipa-prop.h (ipa_alignment): Remove.
(ipa_jump_func): Remove field alignment.
(ipcp_transformation_summary): Remove field alignments.
* doc/invoke.texi: Mark fipa-cp-alignment as obsolete.
* opts.c (default_options_table): Remove entry for fipa-cp-alignment.
(enable_fdo_optimizations): Remove checking for fipa-cp-alignment.
testsuite/
* gcc.dg/ipa/propalign-1.c: Adjust scan-ipa-dump.
* gcc.dg/ipa/propalign-2.c: Likewise
* gcc.dg/ipa/propalign-3.c: Likewise.
* gcc.dg/ipa/propalign-4.c: Likewise.
* gcc.dg/ipa/propalign-5.c: Likewise.
From-SVN: r240898
Diffstat (limited to 'gcc/ipa-prop.c')
-rw-r--r-- | gcc/ipa-prop.c | 229 |
1 files changed, 60 insertions, 169 deletions
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 302a479..a981efd 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -294,15 +294,6 @@ ipa_print_node_jump_functions_for_edge (FILE *f, struct cgraph_edge *cs) ctx->dump (dump_file); } - if (jump_func->alignment.known) - { - fprintf (f, " Alignment: %u, misalignment: %u\n", - jump_func->alignment.align, - jump_func->alignment.misalign); - } - else - fprintf (f, " Unknown alignment\n"); - if (jump_func->bits.known) { fprintf (f, " value: "); print_hex (jump_func->bits.value, f); @@ -402,7 +393,6 @@ static void ipa_set_jf_unknown (struct ipa_jump_func *jfunc) { jfunc->type = IPA_JF_UNKNOWN; - jfunc->alignment.known = false; jfunc->bits.known = false; jfunc->vr_known = false; } @@ -1678,25 +1668,7 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi, useful_context = true; } - if (POINTER_TYPE_P (TREE_TYPE(arg))) - { - unsigned HOST_WIDE_INT hwi_bitpos; - unsigned align; - - get_pointer_alignment_1 (arg, &align, &hwi_bitpos); - if (align > BITS_PER_UNIT - && align % BITS_PER_UNIT == 0 - && hwi_bitpos % BITS_PER_UNIT == 0) - { - jfunc->alignment.known = true; - jfunc->alignment.align = align / BITS_PER_UNIT; - jfunc->alignment.misalign = hwi_bitpos / BITS_PER_UNIT; - } - else - gcc_assert (!jfunc->alignment.known); - gcc_assert (!jfunc->vr_known); - } - else + if (!POINTER_TYPE_P (TREE_TYPE (arg))) { wide_int min, max; value_range_type type; @@ -1723,7 +1695,6 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi, } else gcc_assert (!jfunc->vr_known); - gcc_assert (!jfunc->alignment.known); } if (INTEGRAL_TYPE_P (TREE_TYPE (arg)) @@ -1743,6 +1714,17 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi, jfunc->bits.mask = 0; } } + else if (POINTER_TYPE_P (TREE_TYPE (arg))) + { + unsigned HOST_WIDE_INT bitpos; + unsigned align; + + jfunc->bits.known = true; + get_pointer_alignment_1 (arg, &align, &bitpos); + jfunc->bits.mask = wi::mask<widest_int>(TYPE_PRECISION (TREE_TYPE (arg)), false) + .and_not (align / BITS_PER_UNIT - 1); + jfunc->bits.value = bitpos / BITS_PER_UNIT; + } else gcc_assert (!jfunc->bits.known); @@ -3755,18 +3737,9 @@ ipa_node_params_t::duplicate(cgraph_node *src, cgraph_node *dst, { ipcp_grow_transformations_if_necessary (); src_trans = ipcp_get_transformation_summary (src); - const vec<ipa_alignment, va_gc> *src_alignments = src_trans->alignments; const vec<ipa_vr, va_gc> *src_vr = src_trans->m_vr; - vec<ipa_alignment, va_gc> *&dst_alignments - = ipcp_get_transformation_summary (dst)->alignments; vec<ipa_vr, va_gc> *&dst_vr = ipcp_get_transformation_summary (dst)->m_vr; - if (vec_safe_length (src_trans->alignments) > 0) - { - vec_safe_reserve_exact (dst_alignments, src_alignments->length ()); - for (unsigned i = 0; i < src_alignments->length (); ++i) - dst_alignments->quick_push ((*src_alignments)[i]); - } if (vec_safe_length (src_trans->m_vr) > 0) { vec_safe_reserve_exact (dst_vr, src_vr->length ()); @@ -4698,15 +4671,6 @@ ipa_write_jump_function (struct output_block *ob, } bp = bitpack_create (ob->main_stream); - bp_pack_value (&bp, jump_func->alignment.known, 1); - streamer_write_bitpack (&bp); - if (jump_func->alignment.known) - { - streamer_write_uhwi (ob, jump_func->alignment.align); - streamer_write_uhwi (ob, jump_func->alignment.misalign); - } - - bp = bitpack_create (ob->main_stream); bp_pack_value (&bp, jump_func->bits.known, 1); streamer_write_bitpack (&bp); if (jump_func->bits.known) @@ -4790,17 +4754,6 @@ ipa_read_jump_function (struct lto_input_block *ib, } struct bitpack_d bp = streamer_read_bitpack (ib); - bool alignment_known = bp_unpack_value (&bp, 1); - if (alignment_known) - { - jump_func->alignment.known = true; - jump_func->alignment.align = streamer_read_uhwi (ib); - jump_func->alignment.misalign = streamer_read_uhwi (ib); - } - else - jump_func->alignment.known = false; - - bp = streamer_read_bitpack (ib); bool bits_known = bp_unpack_value (&bp, 1); if (bits_known) { @@ -5166,30 +5119,6 @@ write_ipcp_transformation_info (output_block *ob, cgraph_node *node) } ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node); - if (ts && vec_safe_length (ts->alignments) > 0) - { - count = ts->alignments->length (); - - streamer_write_uhwi (ob, count); - for (unsigned i = 0; i < count; ++i) - { - ipa_alignment *parm_al = &(*ts->alignments)[i]; - - struct bitpack_d bp; - bp = bitpack_create (ob->main_stream); - bp_pack_value (&bp, parm_al->known, 1); - streamer_write_bitpack (&bp); - if (parm_al->known) - { - streamer_write_uhwi (ob, parm_al->align); - streamer_write_hwi_in_range (ob->main_stream, 0, parm_al->align, - parm_al->misalign); - } - } - } - else - streamer_write_uhwi (ob, 0); - if (ts && vec_safe_length (ts->m_vr) > 0) { count = ts->m_vr->length (); @@ -5260,32 +5189,7 @@ read_ipcp_transformation_info (lto_input_block *ib, cgraph_node *node, aggvals = av; } ipa_set_node_agg_value_chain (node, aggvals); - - count = streamer_read_uhwi (ib); - if (count > 0) - { - ipcp_grow_transformations_if_necessary (); - - ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node); - vec_safe_grow_cleared (ts->alignments, count); - - for (i = 0; i < count; i++) - { - ipa_alignment *parm_al; - parm_al = &(*ts->alignments)[i]; - struct bitpack_d bp; - bp = streamer_read_bitpack (ib); - parm_al->known = bp_unpack_value (&bp, 1); - if (parm_al->known) - { - parm_al->align = streamer_read_uhwi (ib); - parm_al->misalign - = streamer_read_hwi_in_range (ib, "ipa-prop misalign", - 0, parm_al->align); - } - } - } - + count = streamer_read_uhwi (ib); if (count > 0) { @@ -5579,58 +5483,6 @@ ipcp_modif_dom_walker::before_dom_children (basic_block bb) return NULL; } -/* Update alignment of formal parameters as described in - ipcp_transformation_summary. */ - -static void -ipcp_update_alignments (struct cgraph_node *node) -{ - tree fndecl = node->decl; - tree parm = DECL_ARGUMENTS (fndecl); - tree next_parm = parm; - ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node); - if (!ts || vec_safe_length (ts->alignments) == 0) - return; - const vec<ipa_alignment, va_gc> &alignments = *ts->alignments; - unsigned count = alignments.length (); - - for (unsigned i = 0; i < count; ++i, parm = next_parm) - { - if (node->clone.combined_args_to_skip - && bitmap_bit_p (node->clone.combined_args_to_skip, i)) - continue; - gcc_checking_assert (parm); - next_parm = DECL_CHAIN (parm); - - if (!alignments[i].known || !is_gimple_reg (parm)) - continue; - tree ddef = ssa_default_def (DECL_STRUCT_FUNCTION (node->decl), parm); - if (!ddef) - continue; - - if (dump_file) - fprintf (dump_file, " Adjusting alignment of param %u to %u, " - "misalignment to %u\n", i, alignments[i].align, - alignments[i].misalign); - - struct ptr_info_def *pi = get_ptr_info (ddef); - gcc_checking_assert (pi); - unsigned old_align; - unsigned old_misalign; - bool old_known = get_ptr_info_alignment (pi, &old_align, &old_misalign); - - if (old_known - && old_align >= alignments[i].align) - { - if (dump_file) - fprintf (dump_file, " But the alignment was already %u.\n", - old_align); - continue; - } - set_ptr_info_alignment (pi, alignments[i].align, alignments[i].misalign); - } -} - /* Update bits info of formal parameters as described in ipcp_transformation_summary. */ @@ -5657,7 +5509,7 @@ ipcp_update_bits (struct cgraph_node *node) next_parm = DECL_CHAIN (parm); if (!bits[i].known - || !INTEGRAL_TYPE_P (TREE_TYPE (parm)) + || !(INTEGRAL_TYPE_P (TREE_TYPE (parm)) || POINTER_TYPE_P (TREE_TYPE (parm))) || !is_gimple_reg (parm)) continue; @@ -5672,12 +5524,53 @@ ipcp_update_bits (struct cgraph_node *node) fprintf (dump_file, "\n"); } - unsigned prec = TYPE_PRECISION (TREE_TYPE (ddef)); - signop sgn = TYPE_SIGN (TREE_TYPE (ddef)); + if (INTEGRAL_TYPE_P (TREE_TYPE (ddef))) + { + unsigned prec = TYPE_PRECISION (TREE_TYPE (ddef)); + signop sgn = TYPE_SIGN (TREE_TYPE (ddef)); + + wide_int nonzero_bits = wide_int::from (bits[i].mask, prec, UNSIGNED) + | wide_int::from (bits[i].value, prec, sgn); + set_nonzero_bits (ddef, nonzero_bits); + } + else + { + unsigned tem = bits[i].mask.to_uhwi (); + unsigned HOST_WIDE_INT bitpos = bits[i].value.to_uhwi (); + unsigned align = tem & -tem; + unsigned misalign = bitpos & (align - 1); - wide_int nonzero_bits = wide_int::from (bits[i].mask, prec, UNSIGNED) - | wide_int::from (bits[i].value, prec, sgn); - set_nonzero_bits (ddef, nonzero_bits); + if (align > 1) + { + if (dump_file) + fprintf (dump_file, "Adjusting align: %u, misalign: %u\n", align, misalign); + + unsigned old_align, old_misalign; + struct ptr_info_def *pi = get_ptr_info (ddef); + bool old_known = get_ptr_info_alignment (pi, &old_align, &old_misalign); + + if (old_known + && old_align > align) + { + if (dump_file) + { + fprintf (dump_file, "But alignment was already %u.\n", old_align); + if ((old_misalign & (align - 1)) != misalign) + fprintf (dump_file, "old_misalign (%u) and misalign (%u) mismatch\n", + old_misalign, misalign); + } + continue; + } + + if (old_known + && ((misalign & (old_align - 1)) != old_misalign) + && dump_file) + fprintf (dump_file, "old_misalign (%u) and misalign (%u) mismatch\n", + old_misalign, misalign); + + set_ptr_info_alignment (pi, align, misalign); + } + } } } @@ -5752,7 +5645,6 @@ ipcp_transform_function (struct cgraph_node *node) fprintf (dump_file, "Modification phase of node %s/%i\n", node->name (), node->order); - ipcp_update_alignments (node); ipcp_update_bits (node); ipcp_update_vr (node); aggval = ipa_get_agg_replacements_for_node (node); @@ -5785,7 +5677,6 @@ ipcp_transform_function (struct cgraph_node *node) fbi.bb_infos.release (); free_dominance_info (CDI_DOMINATORS); (*ipcp_transformations)[node->uid].agg_values = NULL; - (*ipcp_transformations)[node->uid].alignments = NULL; descriptors.release (); if (!something_changed) |