aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop-iv.c
diff options
context:
space:
mode:
authorKewen Lin <linkw@gcc.gnu.org>2019-06-27 05:24:00 +0000
committerKewen Lin <linkw@gcc.gnu.org>2019-06-27 05:24:00 +0000
commitce3ad45c3cbe51fe95936c7676a1fa2cb4f30c1c (patch)
tree077539d005e5d079a641204c6df92dab25626d03 /gcc/loop-iv.c
parent08c1638dab9becfafc65064891c1c59f5711c27f (diff)
downloadgcc-ce3ad45c3cbe51fe95936c7676a1fa2cb4f30c1c.zip
gcc-ce3ad45c3cbe51fe95936c7676a1fa2cb4f30c1c.tar.gz
gcc-ce3ad45c3cbe51fe95936c7676a1fa2cb4f30c1c.tar.bz2
Call finite_loop_p in RTL to get better finiteness information.
gcc/ChangeLog 2019-06-27 Kewen Lin <linkw@gcc.gnu.org> PR target/62147 * gcc/loop-iv.c (find_simple_exit): Call finite_loop_p to update finiteness. gcc/testsuite/ChangeLog 2019-06-27 Kewen Lin <linkw@gcc.gnu.org> PR target/62147 * gcc.target/powerpc/pr62147.c: New test. From-SVN: r272731
Diffstat (limited to 'gcc/loop-iv.c')
-rw-r--r--gcc/loop-iv.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index 82b4bdb..36f9856 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -61,6 +61,7 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "dumpfile.h"
#include "rtl-iter.h"
+#include "tree-ssa-loop-niter.h"
/* Possible return values of iv_get_reaching_def. */
@@ -2997,6 +2998,19 @@ find_simple_exit (struct loop *loop, struct niter_desc *desc)
fprintf (dump_file, "Loop %d is not simple.\n", loop->num);
}
+ /* Fix up the finiteness if possible. We can only do it for single exit,
+ since the loop is finite, but it's possible that we predicate one loop
+ exit to be finite which can not be determined as finite in middle-end as
+ well. It results in incorrect predicate information on the exit condition
+ expression. For example, if says [(int) _1 + -8, + , -8] != 0 finite,
+ it means _1 can exactly divide -8. */
+ if (single_exit (loop) && finite_loop_p (loop))
+ {
+ desc->infinite = NULL_RTX;
+ if (dump_file)
+ fprintf (dump_file, " infinite updated to finite.\n");
+ }
+
free (body);
}