From b34ac019f88b47629673274dd69009f292e03b79 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 20 Nov 2018 10:27:57 +0000 Subject: [PATCH] re PR tree-optimization/88069 (ICE in check_loop_closed_ssa_def, at tree-ssa-loop-manip.c:709) 2018-11-20 Richard Biener PR tree-optimization/88069 * tree-ssa-sccvn.c (visit_phi): Do not value-number to unvisited virtual PHI arguments. * gcc.dg/pr88069.c: New testcase. From-SVN: r266308 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr88069.c | 23 +++++++++++++++++++++++ gcc/tree-ssa-sccvn.c | 19 +++++++++++++------ 4 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr88069.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 75893260d52..9cf7bb1be2e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-11-20 Richard Biener + + PR tree-optimization/88069 + * tree-ssa-sccvn.c (visit_phi): Do not value-number to unvisited + virtual PHI arguments. + 2018-11-20 Ilya Leoshkevich PR target/88083 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 17cb43892a3..099d464d10e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-11-20 Richard Biener + + PR tree-optimization/88069 + * gcc.dg/pr88069.c: New testcase. + 2018-11-20 Martin Liska PR ipa/88093 diff --git a/gcc/testsuite/gcc.dg/pr88069.c b/gcc/testsuite/gcc.dg/pr88069.c new file mode 100644 index 00000000000..21485135016 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr88069.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-pre -ftree-vectorize -fno-tree-pta" } */ + +void +qf (void); + +void +mr (short int db) +{ + int vq; + short int *lp = &db; + + for (vq = 0; vq < 1; ++vq) + qf (); + + while (*lp < 2) + { + *lp = db; + lp = (short int *) &vq; + ++*lp; + } +} + diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 01bedf56662..941752e7887 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -4194,12 +4194,19 @@ visit_phi (gimple *phi, bool *inserted, bool backedges_varying_p) value from the backedge as that confuses the alias-walking code. See gcc.dg/torture/pr87176.c. If the value is the same on a non-backedge everything is OK though. */ - if (backedge_val - && !seen_non_backedge - && TREE_CODE (backedge_val) == SSA_NAME - && sameval == backedge_val - && (SSA_NAME_IS_VIRTUAL_OPERAND (backedge_val) - || SSA_VAL (backedge_val) != backedge_val)) + bool visited_p; + if ((backedge_val + && !seen_non_backedge + && TREE_CODE (backedge_val) == SSA_NAME + && sameval == backedge_val + && (SSA_NAME_IS_VIRTUAL_OPERAND (backedge_val) + || SSA_VAL (backedge_val) != backedge_val)) + /* Do not value-number a virtual operand to sth not visited though + given that allows us to escape a region in alias walking. */ + || (sameval + && TREE_CODE (sameval) == SSA_NAME + && SSA_NAME_IS_VIRTUAL_OPERAND (sameval) + && (SSA_VAL (sameval, &visited_p), !visited_p))) /* Note this just drops to VARYING without inserting the PHI into the hashes. */ result = PHI_RESULT (phi); -- 2.30.2