From a933d47ffaa30ef3c02117ed3e1835758ff2813c Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 16 Feb 2015 14:52:14 +0000 Subject: [PATCH] re PR tree-optimization/63593 (ICE: verify_gimple failed: incompatible types in PHI argument 0 with -O3 -fno-tree-vectorize) 2015-02-16 Richard Biener PR tree-optimization/63593 * tree-predcom.c (execute_pred_commoning_chain): Delay removing stmts and releasing SSA names until... (execute_pred_commoning): ... after processing all chains. * gcc.dg/pr63593.c: New testcase. From-SVN: r220734 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr63593.c | 20 ++++++++++++++++++++ gcc/tree-predcom.c | 20 +++++++++++++++++--- 4 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr63593.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2718a5c4ce3..4062b065bad 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-02-16 Richard Biener + + PR tree-optimization/63593 + * tree-predcom.c (execute_pred_commoning_chain): Delay removing + stmts and releasing SSA names until... + (execute_pred_commoning): ... after processing all chains. + 2015-02-16 Jan Hubicka PR ipa/65059 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index edbb95d5618..c02263ea5cc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-02-16 Richard Biener + + PR tree-optimization/63593 + * gcc.dg/pr63593.c: New testcase. + 2015-02-16 Marek Polacek PR c/65066 diff --git a/gcc/testsuite/gcc.dg/pr63593.c b/gcc/testsuite/gcc.dg/pr63593.c new file mode 100644 index 00000000000..08bc8f976d2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr63593.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fno-tree-vectorize" } */ + +int in[2 * 4][4]; +int out[4]; + +void +foo (void) +{ + int sum; + int i, j, k; + for (k = 0; k < 4; k++) + { + sum = 1; + for (j = 0; j < 4; j++) + for (i = 0; i < 4; i++) + sum *= in[i + k][j]; + out[k] = sum; + } +} diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index ac32c849a12..8dac1ba5afd 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -1745,9 +1745,8 @@ execute_pred_commoning_chain (struct loop *loop, chain_p chain, if (chain->combined) { /* For combined chains, just remove the statements that are used to - compute the values of the expression (except for the root one). */ - for (i = 1; chain->refs.iterate (i, &a); i++) - remove_stmt (a->stmt); + compute the values of the expression (except for the root one). + We delay this until after all chains are processed. */ } else { @@ -1811,6 +1810,21 @@ execute_pred_commoning (struct loop *loop, vec chains, execute_pred_commoning_chain (loop, chain, tmp_vars); } + FOR_EACH_VEC_ELT (chains, i, chain) + { + if (chain->type == CT_INVARIANT) + ; + else if (chain->combined) + { + /* For combined chains, just remove the statements that are used to + compute the values of the expression (except for the root one). */ + dref a; + unsigned j; + for (j = 1; chain->refs.iterate (j, &a); j++) + remove_stmt (a->stmt); + } + } + update_ssa (TODO_update_ssa_only_virtuals); } -- 2.30.2