Hi, this is a fix for another fallout from the fix for 84149
2018-04-27 Martin Jambor <mjam...@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; +} -- 2.16.3