This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Unswitching outer loops.
- 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: Tue, 14 Jul 2015 13:06:57 +0200
- Subject: Re: [PATCH] Unswitching outer loops.
- Authentication-results: sourceware.org; auth=none
- References: <CAEoMCqRi+=wqTGyJaYa+vQiYcxTz8SQGCk1KDjHTX9Ws2+sp6w at mail dot gmail dot com>
On Fri, Jul 10, 2015 at 12:02 PM, Yuri Rumyantsev <ysrumyan@gmail.com> wrote:
> Hi All,
>
> Here is presented simple transformation which tries to hoist out of
> outer-loop a check on zero trip count for inner-loop. This is very
> restricted transformation since it accepts outer-loops with very
> simple cfg, as for example:
> acc = 0;
> for (i = 1; i <= m; i++) {
> for (j = 0; j < n; j++)
> if (l[j] == i) { v[j] = acc; acc++; };
> acc <<= 1;
> }
>
> Note that degenerative outer loop (without inner loop) will be
> completely deleted as dead code.
> The main goal of this transformation was to convert outer-loop to form
> accepted by outer-loop vectorization (such test-case is also included
> to patch).
>
> Bootstrap and regression testing did not show any new failures.
>
> Is it OK for trunk?
I think this is
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=23855
as well. It has a patch adding a invariant loop guard hoisting
phase to loop-header copying. Yeah, it needs updating to
trunk again I suppose. It's always non-stage1 when I come
back to that patch.
Your patch seems to be very specific and only handles outer
loops of innermost loops.
Richard.
> ChangeLog:
> 2015-07-10 Yuri Rumyantsev <ysrumyan@gmail.com>
>
> * tree-ssa-loop-unswitch.c: Include "tree-cfgcleanup.h" and
> "gimple-iterator.h", add prototype for tree_unswitch_outer_loop.
> (tree_ssa_unswitch_loops): Add invoke of tree_unswitch_outer_loop.
> (tree_unswitch_outer_loop): New function.
>
> gcc/testsuite/ChangeLog:
> * gcc.dg/tree-ssa/unswitch-outer-loop-1.c: New test.
> * gcc.dg/vect/vect-outer-simd-3.c: New test.