This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH PR68906]


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]