From ef0519fd4f688558fe2de79e741529655724478d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 15 Nov 2018 08:16:22 +0000 Subject: [PATCH] re PR tree-optimization/87917 (ICE in initialize_matrix_A at gcc/tree-data-ref.c:3150) 2018-11-15 Richard Biener PR middle-end/87917 * tree-data-ref.c (analyze_miv_subscript): Guard calls to analyze_subscript_affine_affine properly. * gcc.dg/tree-ssa/pr87917.c: New testcase. From-SVN: r266173 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/pr87917.c | 14 ++++++++++++++ gcc/tree-data-ref.c | 4 ++-- 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr87917.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6b1fd33e718..174ee432c4f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-11-15 Richard Biener + + PR middle-end/87917 + * tree-data-ref.c (analyze_miv_subscript): Guard calls to + analyze_subscript_affine_affine properly. + 2018-11-15 Xianmiao Qu * config/csky/csky-linux-elf.h (LINUX_DYNAMIC_LINKER): Remove. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a5dfd90de49..0bcd8e0711f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-11-15 Richard Biener + + PR middle-end/87917 + * gcc.dg/tree-ssa/pr87917.c: New testcase. + 2018-11-15 Bin Cheng PR tree-optimization/84648 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr87917.c b/gcc/testsuite/gcc.dg/tree-ssa/pr87917.c new file mode 100644 index 00000000000..2f3862a682a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr87917.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-distribute-patterns -ftrapv -fno-tree-fre" } */ + +void foo(int x[]) +{ + int i, j; + + for (i = 0; i < 2; i++) + for (j = 0; j < 2; j++) + { + x[i] = x[i*j]; + x[i] = x[i*j]; + } +} diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 1fe32365887..ca07bdf7845 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -4038,9 +4038,9 @@ analyze_miv_subscript (tree chrec_a, dependence_stats.num_miv_independent++; } - else if (evolution_function_is_affine_multivariate_p (chrec_a, loop_nest->num) + else if (evolution_function_is_affine_in_loop (chrec_a, loop_nest->num) && !chrec_contains_symbols (chrec_a) - && evolution_function_is_affine_multivariate_p (chrec_b, loop_nest->num) + && evolution_function_is_affine_in_loop (chrec_b, loop_nest->num) && !chrec_contains_symbols (chrec_b)) { /* testsuite/.../ssa-chrec-35.c -- 2.30.2