Hi,
On Tue, 21 May 2019, Richard Biener wrote:
> > Index: gcc/tree-ssa-dce.c
> > ===================================================================
> > --- gcc/tree-ssa-dce.c (revision 271415)
> > +++ gcc/tree-ssa-dce.c (working copy)
> > @@ -417,7 +417,7 @@ find_obviously_necessary_stmts (bool agg
> > }
> >
> > FOR_EACH_LOOP (loop, 0)
> > - if (!finite_loop_p (loop))
> > + if (!loop_has_exit_edges (loop))
> > {
> > if (dump_file)
> > fprintf (dump_file, "cannot prove finiteness of loop
> > %i\n", loop->num);
>
> Bootstrapped / tested on x86_64-unknown-linux-gnu. Fallout:
>
> FAIL: gcc.dg/loop-unswitch-1.c scan-tree-dump unswitch ";; Unswitching loop"
> FAIL: gcc.dg/predict-9.c scan-tree-dump-times profile_estimate "first
> match heuristics: 2.20%" 3
> FAIL: gcc.dg/predict-9.c scan-tree-dump-times profile_estimate "first
> match heuristics: 5.50%" 1
These contain infinite loops without other sideeffects.
> FAIL: gcc.dg/graphite/scop-19.c scan-tree-dump-times graphite "number
> of SCoPs: 0" 2
Loop without sideeffects.
> ...
> UNRESOLVED: gcc.dg/tree-ssa/20040211-1.c scan-tree-dump cddce2 "if "
why unresolved? Anyway, conditionally infinite loop, but without side
effects.
> FAIL: gcc.dg/tree-ssa/loop-10.c scan-tree-dump-times optimized "if " 3
Probably removes one more loop, which is conditionally infinite, but no
side-effects.
> FAIL: gcc.dg/tree-ssa/pr84648.c scan-tree-dump-times cddce1 "Found
> loop 1 to be finite: upper bound found" 1
finite, no side-effect.
> FAIL: gcc.dg/tree-ssa/split-path-6.c scan-tree-dump-times split-paths
> "Duplicating join block" 3
AFAICS all loops therein contain side-effects, though the one in
lookharder() only an invalid one, which might be optimized away, so that
might be it. But this would need to be looked at.
> FAIL: gcc.dg/tree-ssa/ssa-thread-12.c scan-tree-dump thread2 "FSM"
> FAIL: gcc.dg/tree-ssa/ssa-thread-12.c scan-tree-dump thread3 "FSM"
If everything is properly inlined, this contains two nested
side-effect-free loops.
> FAIL: gcc.dg/uninit-28-gimple.c (test for bogus messages, line 9)
But this one doesn't contain a loop at all!?
> I didn't look if the testcases are sensible for loop removal (or what
> actually happens).
IMHO most testcases above (perhaps except gcc.dg/uninit-28-gimple.c and
tree-ssa/split-path-6.c) are sensible for loop removal if mere memory
accesses and possible infiniteness don't count as side-effects.
Ciao,
Michael.