aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-03-19 08:06:48 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2019-03-19 08:06:48 +0000
commit4f683506df6ae4137d5cd362ccb8a50302cf8a2d (patch)
treefd5eb06d2d9857070b38971a4639f934225a74fd /gcc
parentce2c025c2480b6d36eb25b3aae877141ab4c3a5d (diff)
downloadgcc-4f683506df6ae4137d5cd362ccb8a50302cf8a2d.zip
gcc-4f683506df6ae4137d5cd362ccb8a50302cf8a2d.tar.gz
gcc-4f683506df6ae4137d5cd362ccb8a50302cf8a2d.tar.bz2
re PR rtl-optimization/89753 (ICE in unroll_loop_constant_iterations, at loop-unroll.c:498)
PR rtl-optimization/89753 * loop-unroll.c (decide_unroll_constant_iterations): Make guard for explicit unrolling factor even more robust. From-SVN: r269791
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/loop-unroll.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/c-c++-common/unroll-7.c11
4 files changed, 22 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5684358..5ef5871 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2019-03-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR rtl-optimization/89753
+ * loop-unroll.c (decide_unroll_constant_iterations): Make guard for
+ explicit unrolling factor even more robust.
+
2019-03-19 Jakub Jelinek <jakub@redhat.com>
PR target/89726
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 0164762..bc7840e 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -400,7 +400,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 > desc->niter - 1)
+ if (desc->niter == 0 || (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 ae077a1..4e35805 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2019-03-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * c-c++-common/unroll-7.c: New test.
+
2019-03-19 Jakub Jelinek <jakub@redhat.com>
PR target/89726
diff --git a/gcc/testsuite/c-c++-common/unroll-7.c b/gcc/testsuite/c-c++-common/unroll-7.c
new file mode 100644
index 0000000..8332e9f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/unroll-7.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-dominator-opts" } */
+
+int nv;
+
+void test (void)
+{
+ #pragma GCC unroll 2
+ for (nv = 0; nv < 1; ++nv)
+ {}
+}