diff options
author | Martin Jambor <mjambor@suse.cz> | 2013-05-02 16:03:02 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2013-05-02 16:03:02 +0200 |
commit | 7b920a9ac3fa4a0c8b281ba13f1e689e2c7da4ad (patch) | |
tree | 8027a27b3fb600becf052caf7dc0a3248112257e /gcc/ipa-prop.c | |
parent | 2c41c19d5dfc3de0c0b149dc0846c08422c5dded (diff) | |
download | gcc-7b920a9ac3fa4a0c8b281ba13f1e689e2c7da4ad.zip gcc-7b920a9ac3fa4a0c8b281ba13f1e689e2c7da4ad.tar.gz gcc-7b920a9ac3fa4a0c8b281ba13f1e689e2c7da4ad.tar.bz2 |
re PR middle-end/56988 (ipa-cp incorrectly propagates a field of an aggregate)
2013-05-02 Martin Jambor <mjambor@suse.cz>
PR middle-end/56988
* ipa-prop.h (ipa_agg_replacement_value): New flag by_ref.
* ipa-cp.c (ipa_get_indirect_edge_target_1): Also check that by_ref
flags match.
(find_aggregate_values_for_callers_subset): Fill in the by_ref flag of
ipa_agg_replacement_value structures.
(known_aggs_to_agg_replacement_list): Likewise.
* ipa-prop.c (write_agg_replacement_chain): Stream by_ref flag.
(read_agg_replacement_chain): Likewise.
(ipcp_transform_function): Also check that by_ref flags match.
testsuite/
* gcc.dg/ipa/pr56988.c: New test.
From-SVN: r198540
Diffstat (limited to 'gcc/ipa-prop.c')
-rw-r--r-- | gcc/ipa-prop.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 8d1363a..b98f9ad 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -3712,9 +3712,15 @@ write_agg_replacement_chain (struct output_block *ob, struct cgraph_node *node) for (av = aggvals; av; av = av->next) { + struct bitpack_d bp; + streamer_write_uhwi (ob, av->offset); streamer_write_uhwi (ob, av->index); stream_write_tree (ob, av->value, true); + + bp = bitpack_create (ob->main_stream); + bp_pack_value (&bp, av->by_ref, 1); + streamer_write_bitpack (&bp); } } @@ -3732,11 +3738,14 @@ read_agg_replacement_chain (struct lto_input_block *ib, for (i = 0; i <count; i++) { struct ipa_agg_replacement_value *av; + struct bitpack_d bp; av = ggc_alloc_ipa_agg_replacement_value (); av->offset = streamer_read_uhwi (ib); av->index = streamer_read_uhwi (ib); av->value = stream_read_tree (ib, data_in); + bp = streamer_read_bitpack (ib); + av->by_ref = bp_unpack_value (&bp, 1); av->next = aggvals; aggvals = av; } @@ -3955,7 +3964,7 @@ ipcp_transform_function (struct cgraph_node *node) if (v->index == index && v->offset == offset) break; - if (!v) + if (!v || v->by_ref != by_ref) continue; gcc_checking_assert (is_gimple_ip_invariant (v->value)); |