This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH PR68906]
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Yuri Rumyantsev <ysrumyan at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Igor Zamyatin <izamyatin at gmail dot com>
- Date: Wed, 16 Dec 2015 13:51:53 +0100
- Subject: Re: [PATCH PR68906]
- Authentication-results: sourceware.org; auth=none
- References: <CAEoMCqTOxz1mzAwF-A8Vu+1gbmA6eXFOR2J5ZwRfw8ZnDxAP0A at mail dot gmail dot com>
On Wed, Dec 16, 2015 at 1:14 PM, Yuri Rumyantsev <ysrumyan@gmail.com> wrote:
> Hi All,
>
> Here is simple patch which cures the issue with outer-loop unswitching
> - added invocation of number_of_latch_executions() to reject
> unswitching for non-iterated loops.
>
> Bootstrapping and regression testing did not show any new failures.
> Is it OK for trunk?
No, that looks like just papering over the issue.
The issue (with the 2nd testcase at least) is that single_exit () accepts
an exit from the inner loop.
Index: gcc/tree-ssa-loop-unswitch.c
===================================================================
--- gcc/tree-ssa-loop-unswitch.c (revision 231686)
+++ gcc/tree-ssa-loop-unswitch.c (working copy)
@@ -431,7 +431,7 @@ tree_unswitch_outer_loop (struct loop *l
return false;
/* Accept loops with single exit only. */
exit = single_exit (loop);
- if (!exit)
+ if (!exit || exit->src->loop_father != loop)
return false;
/* Check that phi argument of exit edge is not defined inside loop. */
if (!check_exit_phi (loop))
fixes the runtime testcase for me (not suitable for the testsuite due
to the infinite
looping though).
Can you please bootstrap/test the above with your testcase? The above patch is
ok if it passes testing (no time myself right now)
Thanks,
Richard.
> ChangeLog:
>
> 2014-12-16 Yuri Rumyantsev <ysrumyan@gmail.com>
>
> PR tree-optimization/68906
> * tree-ssa-loop-unswitch.c : Include couple header files.
> (tree_unswitch_outer_loop): Use number_of_latch_executions
> to reject non-iterated loops.
>
> gcc/testsuite/ChangeLog
> * gcc.dg/torture/pr68906.c: New test.