diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-03-11 11:40:11 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-03-11 11:40:11 +0000 |
commit | 02f1e01af18fcbb8a3ee166a2da9e286b250fa90 (patch) | |
tree | e9a26063d2e891a3fc84374a0fa9b5bf0192b282 /gcc | |
parent | 6831e9e618da5a8d445c0f6051bf1d82a13ed04a (diff) | |
download | gcc-02f1e01af18fcbb8a3ee166a2da9e286b250fa90.zip gcc-02f1e01af18fcbb8a3ee166a2da9e286b250fa90.tar.gz gcc-02f1e01af18fcbb8a3ee166a2da9e286b250fa90.tar.bz2 |
re PR rtl-optimization/89588 (ICE in unroll_loop_constant_iterations, at loop-unroll.c:498)
PR rtl-optimization/89588
* loop-unroll.c (decide_unroll_constant_iterations): Make guard for
explicit unrolling factor more robust.
From-SVN: r269580
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/loop-unroll.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/unroll-6.c | 9 |
4 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a91a222..166d9ea 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-11 Eric Botcazou <ebotcazou@adacore.com> + + PR rtl-optimization/89588 + * loop-unroll.c (decide_unroll_constant_iterations): Make guard for + explicit unrolling factor more robust. + 2019-03-11 Martin Liska <mliska@suse.cz> Backport from mainline diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 5a03932..4b36e7c 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -399,7 +399,7 @@ decide_unroll_constant_iterations (struct loop *loop, int flags) { /* However we cannot unroll completely at the RTL level a loop with constant number of iterations; it should have been peeled instead. */ - if ((unsigned) loop->unroll - 1 > desc->niter - 2) + if ((unsigned) loop->unroll > desc->niter - 1) { if (dump_file) fprintf (dump_file, ";; Loop should have been peeled\n"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ada8a72..3cbe732 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-03-11 Eric Botcazou <ebotcazou@adacore.com> + + * c-c++-common/unroll-6.c: New test. + 2019-03-11 Martin Liska <mliska@suse.cz> Backport from mainline diff --git a/gcc/testsuite/c-c++-common/unroll-6.c b/gcc/testsuite/c-c++-common/unroll-6.c new file mode 100644 index 0000000..fd74f19 --- /dev/null +++ b/gcc/testsuite/c-c++-common/unroll-6.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-loop-optimize" } */ + +void test (void) +{ + #pragma GCC unroll 2 + for (int nv = 0; nv <= 2; nv += 2) + {} +} |