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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198540
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
+
2013-05-02 Richard Biener <rguenther@suse.de>
* graphds.h (struct graph): Add obstack member.
while (agg_reps)
{
if (agg_reps->index == param_index
- && agg_reps->offset == ie->indirect_info->offset)
+ && agg_reps->offset == ie->indirect_info->offset
+ && agg_reps->by_ref == ie->indirect_info->by_ref)
{
t = agg_reps->value;
break;
struct cgraph_edge *cs;
vec<ipa_agg_jf_item_t> inter = vNULL;
struct ipa_agg_jf_item *item;
+ struct ipcp_param_lattices *plats = ipa_get_parm_lattices (dest_info, i);
int j;
/* Among other things, the following check should deal with all by_ref
mismatches. */
- if (ipa_get_parm_lattices (dest_info, i)->aggs_bottom)
+ if (plats->aggs_bottom)
continue;
FOR_EACH_VEC_ELT (callers, j, cs)
v->index = i;
v->offset = item->offset;
v->value = item->value;
+ v->by_ref = plats->aggs_by_ref;
v->next = res;
res = v;
}
v->index = i;
v->offset = item->offset;
v->value = item->value;
+ v->by_ref = aggjf->by_ref;
v->next = res;
res = v;
}
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);
}
}
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;
}
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));
tree value;
/* The paramter index. */
int index;
+ /* Whether the value was passed by reference. */
+ bool by_ref;
};
typedef struct ipa_agg_replacement_value *ipa_agg_replacement_value_p;
+2013-05-02 Martin Jambor <mjambor@suse.cz>
+
+ PR middle-end/56988
+ * gcc.dg/ipa/pr56988.c: New test.
+
2013-05-02 Ian Bolton <ian.bolton@arm.com>
* gcc.target/aarch64/bics_1.c: New test.
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+/* { dg-add-options bind_pic_locally } */
+
+struct S
+{
+ int a, b, c;
+};
+
+volatile int g;
+
+static void __attribute__ ((noinline, noclone))
+bar (struct S **p)
+{
+ g = 5;
+};
+
+static void __attribute__ ((noinline))
+foo (struct S *p)
+{
+ int i = p->a;
+ if (i != 1)
+ __builtin_abort ();
+ bar (&p);
+}
+
+int
+main (int argc, char *argv[])
+{
+ struct S s;
+ s.a = 1;
+ s.b = 64;
+ s.c = 32;
+ foo (&s);
+
+ return 0;
+}
+