[PR 85549] Add mising check to aggregate IPA-CP propagation
Richard Biener
richard.guenther@gmail.com
Fri Apr 27 18:01:00 GMT 2018
On April 27, 2018 5:36:27 PM GMT+02:00, Martin Jambor <mjambor@suse.cz> wrote:
>Hi,
>
>On Fri, Apr 27 2018, Martin Jambor wrote:
>> Hi,
>>
>> this is a fix for another fallout from the fix for 84149
>
>sorry, I have mistakenly hit the send key. Anyway, this is a fix for
>another fallout from the fix for 84149, in which I have relaxed
>conditions to propagate values along self recursive edges, but in the
>case of aggregate values I forgot to add a check that the pass-though
>jump function along the edge also preserves data passed by reference
>through that pointer.
>
>Fixed by adding the check, the pass has passed bootstrap and LTO
>bootstrap and checking on x86_64-linux. OK for trunk and the gcc 8
>branch?
OK.
Thanks,
Richard.
>Thanks,
>
>Martin
>
>
>
>2018-04-27 Martin Jambor <mjambor@suse.cz>
>
> PR ipa/85549
> * ipa-cp.c (find_aggregate_values_for_callers_subset): Make sure
> the jump function allows for passing through aggregate values.
>
> testsuite/
> * g++.dg/ipa/pr85549.C: New test.
>---
> gcc/ipa-cp.c | 4 +++-
> gcc/testsuite/g++.dg/ipa/pr85549.C | 28 ++++++++++++++++++++++++++++
> 2 files changed, 31 insertions(+), 1 deletion(-)
> create mode 100644 gcc/testsuite/g++.dg/ipa/pr85549.C
>
>diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
>index 1b8f335fd32..4f28a55b862 100644
>--- a/gcc/ipa-cp.c
>+++ b/gcc/ipa-cp.c
>@@ -4372,7 +4372,9 @@ find_aggregate_values_for_callers_subset (struct
>cgraph_node *node,
> {
> struct ipa_jump_func *jfunc
> = ipa_get_ith_jump_func (IPA_EDGE_REF (cs), i);
>- if (self_recursive_pass_through_p (cs, jfunc, i))
>+ if (self_recursive_pass_through_p (cs, jfunc, i)
>+ && (!plats->aggs_by_ref
>+ || ipa_get_jf_pass_through_agg_preserved (jfunc)))
> continue;
> inter = intersect_aggregates_with_edge (cs, i, inter);
>
>diff --git a/gcc/testsuite/g++.dg/ipa/pr85549.C
>b/gcc/testsuite/g++.dg/ipa/pr85549.C
>new file mode 100644
>index 00000000000..ae0336e16b7
>--- /dev/null
>+++ b/gcc/testsuite/g++.dg/ipa/pr85549.C
>@@ -0,0 +1,28 @@
>+/* { dg-do run } */
>+/* { dg-options "-O2" } */
>+
>+#include <vector>
>+
>+#define N 10
>+
>+static void visit(int &level, int n, int k, std::vector< int > &value)
>{
>+ level = level + 1;
>+ value[k] = level;
>+ for (int i = 0 ; i < n; i++)
>+ if (value[i] == 0)
>+ visit(level, n, i, value);
>+}
>+void permutations()
>+{
>+ std::vector< int > value(N);
>+ int level = -1;
>+ visit(level, N, 0, value);
>+}
>+void testExtendByBox() {
>+ permutations();
>+}
>+
>+int main() {
>+ testExtendByBox();
>+ return 0;
>+}
More information about the Gcc-patches
mailing list