diff options
author | Richard Biener <rguenther@suse.de> | 2015-02-18 13:08:58 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-02-18 13:08:58 +0000 |
commit | 8039a35df1ddf6a7ff4a77396f283547c145aa84 (patch) | |
tree | 3777ceaf738435971495c600f1c05fc340338271 /gcc | |
parent | 0c28944fc0afabc39bf675723e2021e306973624 (diff) | |
download | gcc-8039a35df1ddf6a7ff4a77396f283547c145aa84.zip gcc-8039a35df1ddf6a7ff4a77396f283547c145aa84.tar.gz gcc-8039a35df1ddf6a7ff4a77396f283547c145aa84.tar.bz2 |
re PR tree-optimization/65063 (gcc.dg/vect/vect-double-reduc-6.c FAILs with -O3 -fno-tree-loop-ivcanon -fno-tree-vectorize)
2015-02-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/65063
* tree-predcom.c (determine_unroll_factor): Return 1 if we
have replaced looparound PHIs.
* gcc.dg/pr65063.c: New testcase.
From-SVN: r220788
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr65063.c | 33 | ||||
-rw-r--r-- | gcc/tree-predcom.c | 14 |
4 files changed, 57 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6cf817b..9523db0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-02-18 Richard Biener <rguenther@suse.de> + + PR tree-optimization/65063 + * tree-predcom.c (determine_unroll_factor): Return 1 if we + have replaced looparound PHIs. + 2015-02-18 Martin Liska <mliska@suse.cz> * lto-streamer.c (lto_streamer_init): Encapsulate diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0a1a328..5bbdfbb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2015-02-18 Richard Biener <rguenther@suse.de> + PR tree-optimization/65063 + * gcc.dg/pr65063.c: New testcase. + +2015-02-18 Richard Biener <rguenther@suse.de> + PR tree-optimization/62217 * gcc.dg/tree-ssa/cunroll-11.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/pr65063.c b/gcc/testsuite/gcc.dg/pr65063.c new file mode 100644 index 0000000..bcbdbf0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr65063.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-tree-loop-ivcanon -fno-tree-vectorize" } */ + +static int in[8][4]; +static int out[4]; +static const int check_result[] = {0, 16, 256, 4096}; + +static inline void foo () +{ + 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; + } +} + +int main () +{ + int i, j, k; + for (i = 0; i < 8; i++) + for (j = 0; j < 4; j++) + in[i][j] = (i + 2) / 3; + foo (); + for (k = 0; k < 4; k++) + if (out[k] != check_result[k]) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index 8dac1ba..03a38b4 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -1775,9 +1775,21 @@ determine_unroll_factor (vec<chain_p> chains) FOR_EACH_VEC_ELT (chains, i, chain) { - if (chain->type == CT_INVARIANT || chain->combined) + if (chain->type == CT_INVARIANT) continue; + if (chain->combined) + { + /* For combined chains, we can't handle unrolling if we replace + looparound PHIs. */ + dref a; + unsigned j; + for (j = 1; chain->refs.iterate (j, &a); j++) + if (gimple_code (a->stmt) == GIMPLE_PHI) + return 1; + continue; + } + /* The best unroll factor for this chain is equal to the number of temporary variables that we create for it. */ af = chain->length; |