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
This commit is contained in:
parent
08c1638dab
commit
ce3ad45c3c
|
@ -1,3 +1,9 @@
|
|||
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.
|
||||
|
||||
2019-06-26 Jeff Law <law@redhat.com>
|
||||
|
||||
PR tree-optimization/90883
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
2019-06-27 Kewen Lin <linkw@gcc.gnu.org>
|
||||
|
||||
PR target/62147
|
||||
* gcc.target/powerpc/pr62147.c: New test.
|
||||
|
||||
2019-06-26 Jeff Law <law@redhat.com>
|
||||
|
||||
PR tree-optimization/90883
|
||||
PR tree-optimization/90883
|
||||
* g++.dg/tree-ssa/pr90883.C: New test.
|
||||
* gcc.dg/tree-ssa/ssa-dse-36.c: New test.
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/* { dg-do compile { target { powerpc*-*-* } } } */
|
||||
/* { dg-options "-O2 -fno-tree-loop-distribute-patterns" } */
|
||||
|
||||
/* Note that it's required to disable loop-distribute-patterns, otherwise the
|
||||
loop will be optimized to memset. */
|
||||
|
||||
/* Expect loop_iv can know the loop is finite so the doloop_optimize
|
||||
can perform the doloop transformation. */
|
||||
|
||||
typedef struct {
|
||||
int l;
|
||||
int b[258];
|
||||
} S;
|
||||
|
||||
void clear (S* s )
|
||||
{
|
||||
int i;
|
||||
int len = s->l + 1;
|
||||
|
||||
for (i = 0; i <= len; i++)
|
||||
s->b[i] = 0;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler {\mbdnz\M} } } */
|
Loading…
Reference in New Issue