diff options
author | Richard Biener <rguenther@suse.de> | 2017-08-08 12:51:20 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-08-08 12:51:20 +0000 |
commit | 51bd28edcbf49844d696c38af4945ce5fc25ba15 (patch) | |
tree | 84b27b7405d551358230e4089c5e12112127ce6f /gcc/testsuite | |
parent | 26d66f28fdb9bea6e05c2c9f9df7870f9d9f76b2 (diff) | |
download | gcc-51bd28edcbf49844d696c38af4945ce5fc25ba15.zip gcc-51bd28edcbf49844d696c38af4945ce5fc25ba15.tar.gz gcc-51bd28edcbf49844d696c38af4945ce5fc25ba15.tar.bz2 |
re PR middle-end/81719 (Range-based for loop on short fixed size array generates long unrolled loop)
2017-08-08 Richard Biener <rguenther@suse.de>
PR middle-end/81719
* tree-ssa-loop-niter.c: Include tree-dfa.h.
(expand_simple_operations): Also look through ADDR_EXPRs with
MEM_REF bases treating them as POINTER_PLUS_EXPR.
* g++.dg/tree-ssa/pr81719.C: New testcase.
From-SVN: r250954
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/tree-ssa/pr81719.C | 24 |
2 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a3f5d46..1fec0ec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2017-08-08 Richard Biener <rguenther@suse.de> + PR middle-end/81719 + * g++.dg/tree-ssa/pr81719.C: New testcase. + +2017-08-08 Richard Biener <rguenther@suse.de> + PR tree-optimization/81723 * gfortran.dg/pr81723.f: New testcase. diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr81719.C b/gcc/testsuite/g++.dg/tree-ssa/pr81719.C new file mode 100644 index 0000000..6e017af --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr81719.C @@ -0,0 +1,24 @@ +/* { dg-do compile { target c++11 } } */ +/* { dg-options "-O3 -fdump-tree-optimized" } */ + +typedef int Items[2]; + +struct ItemArray +{ + Items items; + int sum_x2() const; +}; + +int ItemArray::sum_x2() const +{ + int total = 0; + for (int item : items) + { + total += item; + } + return total; +} + +/* We should be able to compute the number of iterations to two, unroll + the loop and end up with a single basic-block in sum_x2. */ +/* { dg-final { scan-tree-dump-times "bb" 1 "optimized" } } */ |