From 76afddf36b915170493dfd0c1f28bb85bec808ad Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 24 Mar 2017 12:16:43 +0000 Subject: [PATCH] re PR tree-optimization/80167 (ICE in translate_isl_ast_to_gimple::is_valid_rename at gcc/graphite-isl-ast-to-gimple.c:1139) 2017-03-24 Richard Biener PR tree-optimization/80167 * graphite-isl-ast-to-gimple.c (translate_isl_ast_to_gimple::is_valid_rename): Handle default-defs properly. (translate_isl_ast_to_gimple::get_rename): Likewise. * gcc.dg/graphite/pr80167.c: New testcase. From-SVN: r246438 --- gcc/ChangeLog | 8 ++++++++ gcc/graphite-isl-ast-to-gimple.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/graphite/pr80167.c | 24 ++++++++++++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/graphite/pr80167.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d1dcff02204..de9cd9036a1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-03-24 Richard Biener + + PR tree-optimization/80167 + * graphite-isl-ast-to-gimple.c + (translate_isl_ast_to_gimple::is_valid_rename): Handle default-defs + properly. + (translate_isl_ast_to_gimple::get_rename): Likewise. + 2017-03-23 Kelvin Nilsen * config/rs6000/rs6000.c (rs6000_option_override_internal): Change diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index 3f082da7699..54d07592d2d 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -1123,6 +1123,9 @@ bool translate_isl_ast_to_gimple:: is_valid_rename (tree rename, basic_block def_bb, basic_block use_bb, phi_node_kind phi_kind, tree old_name, basic_block old_bb) const { + if (SSA_NAME_IS_DEFAULT_DEF (rename)) + return true; + /* The def of the rename must either dominate the uses or come from a back-edge. Also the def must respect the loop closed ssa form. */ if (!is_loop_closed_ssa_use (use_bb, rename)) @@ -1178,6 +1181,7 @@ get_rename (basic_block new_bb, tree old_name, basic_block old_bb, basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (rename)); if (is_valid_rename (rename, bb, new_bb, phi_kind, old_name, old_bb) && (phi_kind == close_phi + || ! bb || flow_bb_inside_loop_p (bb->loop_father, new_bb))) return rename; return NULL_TREE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 84ba7aff45e..78de19e09aa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-24 Richard Biener + + PR tree-optimization/80167 + * gcc.dg/graphite/pr80167.c: New testcase. + 2017-03-24 Tom de Vries PR testsuite/80092 diff --git a/gcc/testsuite/gcc.dg/graphite/pr80167.c b/gcc/testsuite/gcc.dg/graphite/pr80167.c new file mode 100644 index 00000000000..990450b2ae6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr80167.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -floop-nest-optimize" } */ + +typedef struct +{ + short a; + short b; + short c; +} d; +extern d e[]; +int f[8]; +void +g (d *i) +{ + int h = 0; + for (; h < 28; h++) + e[h].a = e[h].b = i[h].a; + h = 0; + for (; h < 8; h++) + f[h] = i[h].b + i[h].c; + h = 0; + for (; h < 8; h++) + f[h] = i[h].b; +} -- 2.30.2