From 621e53705ae51337f78713a868ff3dd41f950422 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 26 Sep 2017 11:05:42 +0000 Subject: [PATCH] re PR tree-optimization/82321 (ICE in check_loop_closed_ssa_use, at tree-ssa-loop-manip.c:707) 2017-09-26 Richard Biener PR tree-optimization/82321 * graphite.c (canonicalize_loop_closed_ssa): Properly check for the def being inside the loop. * gcc.dg/graphite/pr82321.c: New testcase. From-SVN: r253199 --- gcc/ChangeLog | 6 +++++ gcc/graphite.c | 4 ++- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.dg/graphite/pr82321.c | 36 +++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/graphite/pr82321.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87801a43cc3..73823fc5e2b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-09-26 Richard Biener + + PR tree-optimization/82321 + * graphite.c (canonicalize_loop_closed_ssa): Properly check + for the def being inside the loop. + 2017-09-26 Andreas Krebbel * config/s390/vx-builtins.md ("vmslg"): Add missing operand in diff --git a/gcc/graphite.c b/gcc/graphite.c index 7e6ba5078ec..6713df62514 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -326,7 +326,9 @@ canonicalize_loop_closed_ssa (loop_p loop) /* Only add close phi nodes for SSA_NAMEs defined in LOOP. */ if (TREE_CODE (arg) != SSA_NAME - || loop_containing_stmt (SSA_NAME_DEF_STMT (arg)) != loop) + || SSA_NAME_IS_DEFAULT_DEF (arg) + || ! flow_bb_inside_loop_p (loop, + gimple_bb (SSA_NAME_DEF_STMT (arg)))) continue; tree res = copy_ssa_name (arg); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 72cf8c3aeef..5beffb30ff8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-09-26 Richard Biener + + PR tree-optimization/82321 + * gcc.dg/graphite/pr82321.c: New testcase. + 2017-09-26 Andreas Krebbel * lib/target-supports.exp: Enable tests for S/390. diff --git a/gcc/testsuite/gcc.dg/graphite/pr82321.c b/gcc/testsuite/gcc.dg/graphite/pr82321.c new file mode 100644 index 00000000000..92321472f9f --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr82321.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -floop-nest-optimize" } */ + +int y8; + +void +dm (int io) +{ + if (y8 != 0) + { + int pu = 1; + + while (io < 2) + { + int xo = (pu != 0) ? y8 : 0; + + while (y8 != 0) + if (xo != 0) + { +gi: + xo = (__INTPTR_TYPE__)&io; + pu = 0; + } + } + } + + if (io != 0) + { + y8 = 1; + while (y8 != 0) + if (io / !y8 != 0) + y8 = 0; + + goto gi; + } +} -- 2.30.2